Centos 7 java 安装 及 tomcat启动

前端之家收集整理的这篇文章主要介绍了Centos 7 java 安装 及 tomcat启动前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

运行tomcat 需要安装java环境:

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

下载了:jdk-8u144-linux-x64.rpm

卸载之前的openjdk

:rpm -qa | grep -E'^open[jre|jdk]|j[re|dk]'

:yum remove java-1.8.0-openjdk

:yum remove java-1.8.0-openjdk-headless


安装:rpm -ivh jdk-8u144-linux-x64.rpm

:环境变量 export JAVA_HOME=/usr/java/default


tomcat daemon.sh 启动 操作步骤:

wgethttp://archive.apache.org/dist/tomcat/tomcat-8/v8.5.12/bin/apache-tomcat-8.5.12-deployer.tar.gz
tar-zxvfapache-tomcat-8.5.12-deployer.tar.gz
mvapache-tomcat-8.5.12-deployer/data/app/tomcat/

cd/data/app/tomcat/bin/
tar-zxvfcommons-daemon-native.tar.gz
cdcommons-daemon-1.0.15-native-src/unix
./configure
make
cpjsvc../..
./daemon.shstart

ok


系统启动 :


cd/usr/lib/systemd/system
vimtomcat.service
[Unit]
Description=Tomcat
After=syslog.targetnetwork.targetremote-fs.targetnss-lookup.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/java/default
ExecStart=/data/app/tomcat/bin/daemon.shstart
ExecStop=/data/app/tomcat/bin/daemon.shstop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctldaemon-reload
systemctlenabletomcat.service
systemctlstoptomcat.service

猜你在找的CentOS相关文章