jdk安装配置。安装目录例如:/usr/JAVA/jdk1.8.0_05
Tomcat下载放到约定目录。例如:/usr/local/dmstomcat
把tomcat做成系统服务,就可以使用service systemctl 快速管理tomcat服务,自启动等。
/usr/lib/systemd/system/目录下新建文件dmstomcat.service
vi /usr/lib/systemd/system/dmstomcat.service
粘贴下面内容:
[Unit] Description=dmstomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking Environment='JAVA_HOME=/usr/java/jdk1.8.0_05' Environment='CATALINA_PID=/usr/local/dms/bin/tomcat.pid' Environment='CATALINA_HOME=/usr/local/dms' Environment='CATALINA_BASE=/usr/local/dms' Environment='CATALINA_OPTS=-Xms2048M -Xmx2048M -server -XX:+UseParallelGC' WorkingDirectory=/usr/local/dms/ ExecStart=/usr/local/dms/bin/startup.sh ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
设置为开启机启动:systemctl enable dmstomcat
常用服务命令:
启动服务:systemctl start dmstomcat 停止服务:systemctl stop dmstomcat 重启服务:systemctl restart dmstomcat 检查状态:systemctl status dmstomcat