centos7安裝tomcat9
1.下載tomcat9 wget http://www.eu.apache.org/dist/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.tar.gz 2.將檔案COPY至USR目錄下,然後解壓縮即可. #cd /usr/local #mkdir tomcat #cd /usr/local/tomcat #cp /var/tmp/apache-tomcat-9.0.7.tar.gz . #tar -xvzf apache-tomcat-9.0.7.tar.gz #mv apache-tomcat-9.0.7 tomcat-9 <== 把目錄名稱改成tomcat 3.設定自動執行 至Tomcat的bin目錄執行 vi setenv.sh 輸入以下內容 #add tomcat pid CATALINA_PID= " $CATALINA_BASE /tomcat.pid" 4.vi /usr/lib/systemd/system/tomcat.service 輸入以下內容 [Unit] Description=Tomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/ local /tomcat/tomcat-9/tomcat.pid ExecStart=/usr/ local /tomcat/tomcat-9/bin/startup.sh ExecReload=/bin/ kill -s HUP $MAINPID ExecStop=/bin/ kill -s QUIT $MAINPID PrivateTmp= true [Install] WantedBy=multi-user.target 5.系統參數啟動TOMCAT //配置开机启动 systemctl enable tomcat //启动tomcat systemctl start tomcat //停止tomcat system