环境准备
[root@web01 ~]# java -version
openjdk version “1.8.0_181”
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[root@web01 ~]# java -version
openjdk version “1.8.0_181”
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
cd /usr/local
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34.tar.gz
tar zxf apache-tomcat-8.5.34.tar.gz
vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
export CLASS_PATH=.:$JAVA_HOME/lib
export CATALINA_HOME=/usr/local/apache-tomcat-8.5.34
export CATALINA_BASE=/usr/local/apache-tomcat-8.5.34
export PATH=$PATH:$JAVA_HOME/bin:$CATLINA_HOME:/bin
source /etc/profile
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
export CLASS_PATH=.:$JAVA_HOME/lib
export CATALINA_HOME=/usr/local/apache-tomcat-8.5.34
export CATALINA_BASE=/usr/local/apache-tomcat-8.5.34
export PATH=$PATH:$JAVA_HOME/bin:$CATLINA_HOME:/bin
source /etc/profile
tomcat需要增加一个pid文件
在tomcat/bin目录下
vim setenv.sh
#add tomcat pid
CATALINA_PID=”$CATALINA_BASE/tomcat.pid”
#add java opts
JAVA_OPTS=”-server -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m”
在tomcat/bin目录下
vim setenv.sh
#add tomcat pid
CATALINA_PID=”$CATALINA_BASE/tomcat.pid”
#add java opts
JAVA_OPTS=”-server -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m”
增加tomcat.service
在/usr/lib/systemd/system目录下
vim tomcat.service
[Unit]
Ddescription=Apach Tomcat 8
After=syslog.target network.target
在/usr/lib/systemd/system目录下
vim tomcat.service
[Unit]
Ddescription=Apach Tomcat 8
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/usr/local/apache-tomcat-8.5.34/tomcat.pid
ExecStart=/usr/local/apache-tomcat-8.5.34/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
#User=tomcat
#Group=tomcat
Type=forking
PIDFile=/usr/local/apache-tomcat-8.5.34/tomcat.pid
ExecStart=/usr/local/apache-tomcat-8.5.34/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
#User=tomcat
#Group=tomcat
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
systemctl enable tomcat
systemctl start tomcat
systemctl start tomcat
相关文章
标签:服务器技术
- •VMware Workstation Pro 16安装CentOS7超详细图文步骤
- •CentOS7下配置使用JumpServer 堡垒机 (图文教程)
- •CentOS安装jdk的几种方法及配置环境变量方式
- •CentOS忘记密码修改方案以及centos卡在开机登录界面,命令失效的解决方法
- •解决笔记本安装centos7后无法调节屏幕亮度
- •VMware安装CentOS 8.1(CentOS 8系列可参考)的图文详细教程
- •CentOS7 minimal 最小化安装网络设置过程
- •CentOS7下搭建JumpServer
- •CentOS安装rpm包出现冲突时的解决办法
- •Vmware下CentOS7最小化安装方式