系统环境:CentOS 6.5
JDK:jdk-7u60-linux-x64.tar.gz
tomcat:apache-tomcat-7.0.54.tar.gz
1:建立安装目录
# mkdir /doiido/soft
# mkdir /doiido/apps
# mkdir /doiido/server
2:上传jdk-7u60-linux-x64.tar.gz至/doiido/soft
# cd /doiido/soft/
# tar zxvf jdk-7u60-linux-x64.tar.gz
# mv jdk1.7.0_60/ /doiido/server/
3:设置刚刚安装的JDK为默认的JDK
# update-alternatives --install /usr/bin/java java /doiido/server/jdk1.7.0_60/bin/java 300
# update-alternatives --install /usr/bin/javac javac /doiido/server/jdk1.7.0_60/bin/javac 300
4:设置环境变量
# vi /etc/profile
#在最后加入如下参数
Java_HOME=/doiido/server/jdk1.7.0_60
PATH=$Java_HOME/bin:$PATH
CLASSPATH=.:$Java_HOME/lib/tools.jar:$Java_HOME/lib/dt.jar
export Java_HOME PATH CLASSPATH
5:激活配置
# source /etc/profile
6:查看Java版本,看是否配置合适
# java -version
7:上传apache-tomcat-7.0.54.tar.gz至/doiido/soft
# cd /doiido/soft
# tar zxvf apache-tomcat-7.0.54.tar.gz
# mv apache-tomcat-7.0.54 /doiido/apps/tomcat7
8:设置tomcat权限
# cd /doiido/apps/tomcat7/bin/
# chmod 777 *.sh
9:启动tomcat
# sh startup.sh
10:防火墙端口开放
# /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
# /etc/rc.d/init.d/iptables save
11:设置开机启动
# echo "/doiido/apps/tomcat7/bin/startup.sh" >> /etc/rc.local
这个时候就可以访问了