Linux Centos7 安装Tomcat
一、下载:
sudo wget https://downloads.apache.org/tomcat/tomcat-11/v11.0.2/bin/apache-tomcat-11.0.2.tar.gz
或者到官网下载
当前最新版为11
二、安装
1)解压
tar -zxvf apache-tomcat-11.0.2.tar.gz -C /u01/tomcat
2)新增用户和组
-- 新增用户组
sudo groupadd tomcat
-- 新增用户
sudo useradd -M -s /bin/nologin -g tomcat -d /u01/tomcat/apache-tomcat-11.0.2 tomcat
3)赋权限
sudo chown -R tomcat:tomcat /u01/tomcat/apache-tomcat-11.0.2
4)修改端口(可修改也可以默认)
/config/Server.xml
5)在/etc/systemd/system/ 创建服务文件 tomcat.service,填写信息
[Unit]
Description=Apache Tomcat 11.0.2
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment=CATALINA_HOME=/u01/tomcat/apache-tomcat-11.0.2
Environment=JAVA_HOME=/u01/java/jdk-21.0.5
Environment=CATALINA_PID=/u01/tomcat/apache-tomcat-11.0.2/temp/tomcat.pid
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
ExecStart=/u01/tomcat/apache-tomcat-11.0.2/bin/startup.sh
ExecStop=/u01/tomcat/apache-tomcat-11.0.2/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
6)重新加载 systemd 配置
sudo systemctl daemon-reload
7)启动 要使 Jenkins 在系统启动时自动启动
sudo systemctl enable tomcat
8)启动
sudo systemctl start tomcat
9)查状态
sudo systemctl status tomcat
原文地址:https://blog.csdn.net/u010411264/article/details/145160166
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!