1.SELINUX和防火墙
#关闭SELINUX
vi /etc/selinux/config
SELINUX = disabled
#防火墙
1)关闭防火墙
Centos6.5版本
service iptables stop#关闭防火墙
chkconfig iptables off#开机不启动
Centos7版本
systemctl start firewalld.service #启动防火墙
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #禁止开机启动
2)开通端口
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT #开启80端口
service iptables restart #重启防火墙生效
2.Tomcat安装与配置
1)获取安装包;
https://pan.baidu.com/s/1i5ln2p3
解压;对tomcat文件夹赋予权限
chmod -R 755 /usr/tomcat/apache-tomcat-7.0.57_Linux_64bit
2)拷贝tomcat的bin目录下tomcat- service启动脚本至/etc/init.d/ ,重命名为tomcat
cp /usr/tomcat/apache-tomcat-7.0.57_Linux_64bit/bin/tomcat-service /etc/init.d/tomcat
3)CATALINA_HOME以及JVM参数调整
sed -i "s/\/usr\/local\/tomcat7/\/usr\/tomcat\/apache-tomcat-7.0.57_Linux_64bit/g" /etc/init.d/tomcat
chmod +x /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig --level 345 tomcat onsed -i "s/wrapper.java.maxmemory=768/wrapper.java.maxmemory=2048/g" /usr/tomcat/apache-tomcat-7.0.57_Linux_64bit/bin/wrapper.conf
3.端口号修改
conf目录下server.xml的port参数(默认8080)
4.重启tomcat
service tomcat restart