CentOS 6.5安装tomcat8

1.查看是否安装jdk

[root@localhost ~]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

2.tomcat下载

http://124.205.69.166/files/917300000333E604/mirrors.noc.im/apache/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz

3.软件解压

[root@localhost soft]# tar -zxvf apache-tomcat-8.5.16.tar.gz -C /usr/local

4.安装tomcat

[root@localhost tomcat]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/java/jdk1.8.0_151
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.

5.安装成功,防火墙开放8080端口,增加到防火墙配置中

配置8080开放端口:
[root@localhost tomcat]# /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
[root@localhost tomcat]# /etc/rc.d/init.d/iptables save iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定] [root@localhost tomcat]# /etc/rc.d/init.d/iptables restart iptables:将链设置为政策 ACCEPT:filter [确定] iptables:清除防火墙规则: [确定] iptables:正在卸载模块: [确定] iptables:应用防火墙规则: [确定]

6.关闭Tomcat

[root@localhost tomcat]# /usr/local/tomcat/bin/shutdown.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/java/jdk1.8.0_151
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

7.启动Tomcat

[root@localhost tomcat]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/java/jdk1.8.0_151
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.

8.ip:8080访问

 

扩展:

设置Tomcat的开机自启动,在/etc/rc.d/rc.local的底部添加下面内容。

[root@Wulaoer ~]# vi /etc/rc.d/rc.local
touch /var/lock/subsys/local
export JDK_HOME=/usr/java/jdk1.8.0_73
export JAVA_HOME=/usr/java/jdk1.8.0_73
/usr/local/tomcat/bin/startup.sh

注意:jdk的路径和tomcat的路径要根据自己安装的路径。重启以下测试

修改端口:

示例:把8080端口修改成80端口。

[root@Wulaoer ~]# vi /usr/local/tomcat/conf/server.xml

文件中找到:
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />

把8080修改程80,保存重启以下tomcat,直接访问测试 

转载于:https://www.cnblogs.com/SEVEN-wkq/p/8487264.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值