一、执行命令,创建目录
mkdir ?-p /home/jysoft/tomcat
二、上传tomcat安装包至上述目录下,并解压
三、修改tomcat配置
1.配置JDK
/home/jysoft/tomcat/tomcat9-10080/bin 目录下setenv.sh 配置JDK
#!/bin/sh
JAVA_HOME="/home/jysoft/java/jdk-11.0.11+9"
JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms256m -Xmx2048m -Xss1024K -XX:MaxNewSize=256m -XX:ReservedCodeCacheSize=64m"
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
2.install.sh? ?脚本
#!/bin/sh
cp /home/jysoft/tomcat/tomcat9-10080/tomcat-10080.service /usr/lib/systemd/system
chmod 555 /usr/lib/systemd/system/tomcat-10080.service
systemctl enable tomcat-10080
systemctl start tomcat-10080
3.remove.sh? 脚本
#!/bin/sh
systemctl stop tomcat-10080
systemctl disable tomcat-10080
rm -f /usr/lib/systemd/system/tomcat-10080.service
4.tomcat-10080.service?
[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/home/jysoft/tomcat/tomcat9-10080/tomcat.pid
ExecStart=/home/jysoft/tomcat/tomcat9-10080/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/home/jysoft/tomcat/tomcat9-10080/bin/shutdown.sh
PrivateTmp=true
User=root
[Install]
WantedBy=multi-user.target
四、执行install.sh 安装脚本?
? ? ? sh? install.sh
五:启动tomcat
? ? systemctl? restart? tomcat-10080
六、使用nginx代理,访问tomcat,出现一下界面,即安装成功
? ? ?nginx代理不会的可以参考我写的nginx安装的文章
|