Linux服务器上部署Tomcat测试环境
部署Tomcat网站测试环境
- MobaXterm SSH连上终端服务器
- 下载jdk并配置java环境
- 下载tomcat:
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.92/bin/apache-tomcat-7.0.92.tar.gz
并解压到当前目录下:tar zxvf apache-tomcat-7.0.92.tar.gz
4.照文Tomcat 部署项目的三种方法第一种方法部署,将jeesite.war放入tomcat下webapps目录。
5.由于tomcat默认端口8080,照文无法访问部署在linux上的Tomcat服务器解决方案查看防火墙规则:
iptables -L --line-number
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
2 ACCEPT icmp -- anywhere anywhere
3 ACCEPT all -- anywhere anywhere
4 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
5 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
需要开放8080端口:
iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
6.进入tomcat bin目录启动服务器:sh startup.sh
启动时可查看日志:tailf apache-tomcat-7.0.92/logs/catalina.out
部署时若报错:RROR [net.sf.ehcache.Cache] - Unable to set localhost. This prevents creation of a GUID. Cause was: Centos10:
需要找到/etc/hosts,将Centos10加入,如下所示:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 Centos10
更新网站
- MobaXterm SSH连上终端服务器
- 进入tomcat bin目录关闭服务器:sh shutdown.sh
- 删除tomcat下webapps目录中的jeesite文件夹
- 将更新的jeesite.war放入tomcat下webapps目录
- 进入tomcat bin目录开启服务器:sh startup.sh