由于软件下载地址经常有变动,所以不能直接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 /tmp
tar -zxvf jdk-7u60-linux-x64.gz
mv jdk1..0_60 /usr
vi /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..tar.gz
cp -r /tmp/apache-tomcat-7.0. /data
cd /data
mv apache-tomcat-7.0./ tomcat
cd /data/tomcat/bin
./startup.sh
用浏览器打开如下的网页
http://localhost:8080/;
如果你见到Tomcat的网页(index.jsp),证明Tomcat安装成功,并已经启动.
如果你见到Tomcat的网页(index.jsp),证明Tomcat安装成功,并已经启动.
jdk环境错误,$JAVA_HOME这个变量没有定义时,解决情况如下
cd /data/tomcat/bin
vi 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### 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