由于軟件下載地址經常有變動,所以不能直接wget,還是直接到網上點擊下載
下載jdk
http://www.Oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
選中Accept License Agreement,選擇64位的jdk-7u65-linux-x64.tar.gz,如下圖
下載tomcat,tomcat版本會更新,以下載版本號為準
http://tomcat.apache.org/download-70.cgi
把軟件上傳到/tmp中
安裝jdk
cd /tmptar -zxvf jdk-7u60-linux-x64.gzmv jdk1.7.0_60 /usrvi /etc/PRofile
在prifile文件結尾插入下一段
export JAVA_HOME=/usr/jdk1.7.0_60export JAVA_BIN=/usr/jdk1.7.0_60/binexport PATH=$PATH:$JAVA_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
保存文檔,然后讓配置生效
source /etc/profile
安裝tomcat
tar -zxvf apache-tomcat-7.0.54.tar.gzcp -r /tmp/apache-tomcat-7.0.54 /datacd /datamv apache-tomcat-7.0.54/ tomcatcd /data/tomcat/bin./startup.sh用瀏覽器打開如下的網頁http://localhost:8080/;如果你見到Tomcat的網頁(index.jsp),證明Tomcat安裝成功,并已經啟動.jdk環境錯誤,$JAVA_HOME這個變量沒有定義時,解決情況如下
cd /data/tomcat/binvi setclasspath.sh
在setclasspath.sh中插入紅色部分
#!/bin/sh# Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements. See the NOTICE file distributed with# this work for additional information regarding copyright ownership.# The ASF licenses this file to You under the Apache License, Version 2.0# (the "License"); you may not use this file except in compliance with# the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.# -----------------------------------------------------------------------------# Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings# are valid and consistent with the selected start-up options and set up the# endorsed directory.# -----------------------------------------------------------------------------# Make sure prerequisite environment variables are setexport JAVA_HOME=/usr/jdk1.7.0_60export JRE_HOME=/usr/jdk1.7.0_60/jre/保存文本,重啟tomcat
新聞熱點
疑難解答