1.将tomcat安装包apache-tomcat-7.0.57-windows-x64.zip在本地解压后放到/usr/local目录
2.修改解压后的目录的权限
[root@localhost local]# chmod -cfvR 777 apache-tomcat-7.0.57/
3.修改环境变量:
[root@localhost java]# vi ~/.bashrc
export CATALINA_HOME=/usr/local/apache-tomcat-7.0.57
使配置的环境变量生效
[root@localhost java]# source ~/.bashrc
如图:
4.启动tomcat命令:
[root@localhost local]# /usr/local/apache-tomcat-7.0.57/bin/startup.sh
显示下面信息表明启动成功
5. 关闭命令:
[root@localhost local]# /usr/local/apache-tomcat-7.0.57/bin/shutdown.sh
6.修改端口:
Tomcat默认端口为8080,为了防止和ATCTI端口冲突需要改为8090
修改Tomcat目录下的conf/server.xml文件
将<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
改为<Connector connectionTimeout="20000" port="8090" protocol="HTTP/1.1" redirectPort="8443"/>
7. 加入系统服务:
将tomcat的系统自启动文件拷贝到/etc/rc.d/init.d/目录
修改权限:chmod 777 /etc/rc.d/init.d/tomcat
执行命令:chkconfig --add tomcat
查看是否加入成功:chkconfig
之后启动和关闭tomcat可以通过以下命令来操作,并且tomcat会开机自动启动
service tomcat start
service tomcat stop