首先需要在下载最新安装包
安装tomcat
将apache-tomcat-8.0.15.tar.gz文件上传到/usr/local中执行以下操作:
复制代码代码如下:[root@admin local]# cd /usr/local[root@admin local]# tar -zxvf apache-tomcat-8.0.15.tar.gz // 解压压缩包[root@admin local]# rm -rf apache-tomcat-8.0.15.tar.gz.tar.gz // 删除压缩包[root@admin local]# mv apache-tomcat-8.0.15 tomcat启动Tomcat执行以下操作:复制代码代码如下:[root@admin ~]# /usr/local/tomcat/bin/startup.sh //启动tomcatUsing CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: /usr/local/tomcat/tempUsing JRE_HOME: /usr/java/jdk1.7.0/jreUsing CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar出现以上信息说明已成功启动。
如果出现下面错误:
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
则要注意前提还要设置java路径
在apache-tomcat-8.0.15/bin/setclasspath.sh中添加一下内容
export JAVAHOME=/opt/jdk1.8.0
export JREHOME=/opt/jdk1.8.0/jreexport CLASSPATH=.:$JAVAHOME/lib:$JREHOME/lib:$CLASSPATHexport PATH=$JAVAHOME/bin:$JREHOME/bin:$PATH
防火墙开放8080端口
增加8080端口到防火墙配置中,执行以下操作:[root@admin ~]# vi + /etc/sysconfig/iptables#增加以下代码-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT重启防火墙[root@admin java]# service iptables restart检验Tomcat安装运行通过以下地址查看tomcat是否运行正常:http://192.168.15.231:8080/看到tomcat系统界面,说明安装成功!停止Tomcat[root@admin ~]# /usr/local/tomcat/bin/shutdown.sh //停止tomcat