debian 9安装openjdk,tomcat以及开机启动tomcat的方法

By admin at 2021-02-23 21:15 • 211次点击
admin


安装jdk1.8

apt-get install openjdk-8-jdk

安装tomcat 8

 useradd -m -U -d /opt/tomcat -s /bin/false tomcat
//添加运行用户
cd /tmp
wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.51/bin/apache-tomcat-8.5.51.zip
unzip apache-tomcat-*.zip
mv apache-tomcat-*/ /opt/tomcat
chown -R tomcat: /opt/tomcat
chmod +x /opt/tomcat/latest/bin/*.sh

开机启动tomcat 8

添加新的/etc/rc.local文件

cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/bin/su -s /bin/bash -c "/opt/tomcat/bin/startup.sh" tomcat
exit 0
EOF

//把启动tomcat脚本丢在exit 0之前即可

也可以写成独立启动脚本

#!/bin/bash
/bin/su -s /bin/bash -c "/opt/tomcat/bin/startup.sh" tomcat

chmod +x /etc/rc.local

systemctl start rc-local



也许我的文章解决了你的问题,如果没有那很抱歉,
真诚希望您能把本站开启广告白名单,谢谢您~
联系邮箱vpslala#foxmail.com


鄙人非专业程序員,只是一个深度网瘾者,爱好折腾网络
现在百分之九十的都开启了广告过滤,更新不易.
请我喝杯咖啡吧,是我一直更新下去不删库跑路的动力.


打赏


tomcat, debian, openjdk, 开机, 安装


目前尚无回复
登录 后发表评论