自学内容网 自学内容网

tomcat--安装

官网:Apache Tomcat® - Welcome!

官网文档:Apache Tomcat 8 (8.5.100) - Documentation Index

帮助文档:Apache Tomcat Home - Apache Tomcat - Apache Software Foundation

                  FAQ - Apache Tomcat - Apache Software Foundation

yum安装

查看安装包

yum list tomcat

 安装

yum -y install tomcat tomcat-webapps tomcat-admin-webapps tomcat-docs-webapp

开机自启动

 systemctl enable --now tomcat

 查看

ss -ntl

getent passwd tomcat

ps aux|grep tomcat

访问

 二进制安装

官方和镜像下载:Apache Tomcat® - Apache Tomcat 8 Software Downloads

                             Index of /apache/tomcat

准备

wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.100/bin/apache-tomcat-8.5.100.tar.gz 

tar -zxvf apache-tomcat-8.5.100.tar.gz -C /usr/local/

cd /usr/local/

 配置变量

echo 'PATH=/usr/local/apache-tomcat-8.5.100/bin:$PATH' > /etc/profile.d/tomcat.sh

. /etc/profile.d/tomcat.sh

 查看

 启动

startup.sh

catalina.sh start

 关闭

catalina.sh stop 10 10秒后关闭

catalina.sh stop

shutdown.sh

 配置service文件

 创建用户

useradd -r -s /sbin/nologin tomcat

 创建conf文件

[root@localhost ~]# cat /usr/local/apache-tomcat-8.5.100/conf/tomcat.conf
JAVA_HOME=/usr/local/jdk1.8.0_291

 配置service文件

[root@localhost ~]# cat /lib/systemd/system/tomcat.service
[Unit]
Description=Tomcat
#After=syslog.target network.target remote-fs.target nss-lookup.target
After=syslog.target network.target
[Service]
Type=forking
EnvironmentFile=/usr/local/apache-tomcat-8.5.100/conf/tomcat.conf
ExecStart=/usr/local/apache-tomcat-8.5.100/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-8.5.100/bin/shutdown.sh
PrivateTmp=true
User=tomcat
Group=tomcat
[Install]
WantedBy=multi-user.target

启动tomcat

 systemctl enable --now  tomcat

访问


原文地址:https://blog.csdn.net/m0_65342309/article/details/138848045

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!