1、 下载并 安装 tomcat
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.14/bin/apache-tomcat-8.0.14.tar.gz
解压缩tomcat
#tar –zxvf apache-tomcat-8.0.14.tar.gz
2、 设置路经
使用命令编辑vi /etc/profile,在文件中加入如下几行
JAVA_HOME=/usr/java/jdk1.7.0_67 #我安装是该版本jdk
CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar:$CLASS_PATH
PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/user/local/apache-tomcat-8.0.14
CATALINA_HOME=$TOMCAT_HOME
PATH=$TOMCAT_HOME/bin:$PATH
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC CLASS_PATH JAVA_HOME TOMCAT_HOME CATALINA_HOME
到/usr/local/apache-tomcat-8.0.14下,把以下几句加入startup.sh和shutdown.sh两个文件
JAVA_HOME=/usr/java/jdk1.7.0_67
CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar:$CLASS_PATH
PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/user/local/apache-tomcat-8.0.14
CATALINA_HOME=$TOMCAT_HOME
PATH=$TOMCAT_HOME/bin:$PATH
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC CLASS_PATH JAVA_HOME TOMCAT_HOME CATALINA_HOME
3、设置IP和Port
Tomcat缺省的Port number是8080.打开文件tomcat/conf/server.xml,找到如下的字段:
“<Connector port=8080“
然后把8080改成80即可.
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
address="192.168.34.12" />
4、设置Tomcat管理用户
[[email protected] conf]# vi tomcat-users.xml
<role rolename="admin”>
<user username="admin" password="admin" roles="admin,manager"/>
5、 启动tomcat
重启电脑后启动tomcat:可以不重启!
[[email protected] bin]# pwd
[[email protected] bin]# ./startup.sh
关闭tomcat:
[[email protected] bin]# ./shutdown.sh