Centos7 安裝 tomcat8

###安裝tomcat8java

  • 下載
$ cd /home/
$ wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.4/bin/apache-tomcat-8.5.4.tar.gz
$ tar zxvf apache-tomcat-8.5.4.tar.gz
$ mv apache-tomcat-8.5.4 tomcat8 && cd tomcat8
  • 配置環境
  1. vi bin/setenv.sh
#add tomcat pid  
 CATALINA_PID="$CATALINA_BASE/tomcat.pid"  
#add java opts  
JAVA_OPTS="-server -XX:PermSize=512M -XX:MaxPermSize=1024m -Xms1024M -Xmx2048M -XX:MaxNewSize=512m "  
JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"
  1. vi conf/catalina.properties

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=
*.jarapache

systemd開機啓動

  • 啓動腳本

vi /usr/lib/systemd/system/tomcat.servicetomcat

[Unit]  
Description=Tomcat8
After=syslog.target network.target remote-fs.target nss-lookup.target  
   
[Service]  
Type=forking  
PIDFile=/home/tomcat8/tomcat.pid  
ExecStart=/home/tomcat8/bin/startup.sh   
ExecReload=/bin/kill -s HUP $MAINPID  
ExecStop=/bin/kill -s QUIT $MAINPID  
PrivateTmp=true  
   
[Install]  
WantedBy=multi-user.target
  • 設置開機啓動
$ systemctl enable tomcat
$ systemctl daemon-reload
$ systemctl restart tomcat
相關文章
相關標籤/搜索