Linux在线安装Tomcat

1. 下载tomcat:
#wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz

2. 将tomcat放置到 / server / tomcat / 目录下
#mv apache-tomcat-7.0.54.tar.gz / server / tomcat /

3. 解压缩:
tar -xvzf /server/tomcat/apache-tomcat-7.0.54.tar.gz

4. 设置tomcat开机自启动,编辑/server/tomcat/apache-tomcat-7.0.54/bin/startup.sh
# vi /server/tomcat/apache-tomcat-7.0.54/bin/startup.sh
加入如下行:
#chkconfig: 2345 80 90
#description:tomcat auto start
#processname: tomcat

chkconfig是让tomcat以service方式运行,这行表示缺省启动的运行级别以及启动和停止的优先级,如该服务缺省不再任何运行级启动,则以 - 代替运行级别。此例在tomcat中表示脚本在运行级2、3、4、5启动,启动优先权为80,停止优先权为90。

语 法:chkconfig [--add][--del][--list][系统服务] 或 chkconfig [--level <等级代号>][系统服务][on/off/reset]
description行对服务进行描述.

5. 将tomcat加入开机自启动
# vi /etc/rc.d/rc.local
加入如下内容:
/server/tomcat/apache-tomcat-7.0.54/bin/startup.sh start

执行# /server/tomcat/apache-tomcat-7.0.54/bin/startup.sh 启动tomcat,
执行# /server/tomcat/apache-tomcat-7.0.54/bin/shutdown.sh 关闭tomcat

tomcat默认监听8080端口,如果要修改端口,按如下步骤修改:

# vi /server/tomcat/apache-tomcat-7.0.54/conf/server.xml
找到
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
<Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

修改为:
<Connector port="9080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
<Connector executor="tomcatThreadPool"
               port="9080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

Linux在线安装Tomcat

上一篇:Linux在线安装jdk


下一篇:Win10 - 一次定位 - 由于显卡驱动相关, 导致的 CPU 占用率过高