首页 > 代码库 > centos6.5安装tomcat8.0.15
centos6.5安装tomcat8.0.15
首先需要在http://tomcat.apache.org/download-80.cgi下载最新安装包
安装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 //启动tomcat
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.7.0/jre
Using 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/jre
export CLASSPATH=.:$JAVAHOME/lib:$JREHOME/lib:$CLASSPATH
export 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
centos6.5安装tomcat8.0.15