To deploy the installation of tomcat web service

Tomcat Service

1, Tomcat Introduction

Tomcat is the world's most famous lightweight Java-based application server, is a completely free open source Servlet container implementation. At the same time, it supports the deal with static resources HTML, JS, etc., so they can be used as a lightweight Web server

2, installation and deployment

2.1 installed java environment

 yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel -y

2.2 java binary installation and configuration environment

# tar -xvf jdk-8u211-linux-x64.tar.gz -C /usr/local
# cd /usr/local/
# mv jdk1.8.0_211/ jdk1.8.0
# vim /etc/profile.d/jdk1.8.sh  #设置环境变量

# java environment
export JAVA_HOME=/usr/local/jdk1.8.0
export PATH=$JAVA_HOME/bin/:$PATH


# source /etc/profile.d/jdk1.8.sh

verification

[root@controller1 ~]# java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

2.1yum source installation

# yum install tomcat-admin-webapps tomcat-webapps -y
# systemctl start tomcat
# systemctl enable tomctl
# ss -tnl   查看8009、8080端口开启

Binary installation

# wget https://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz
# tar -xvf apache-tomcat-8.5.45.tar.gz -C /usr/local/
# cd /usr/local/
# ln -sv apache-tomcat-8.5.45/ tomcat
# ll
 tomcat -> apache-tomcat-8.5.45/

# cd tomcat/bin/
# ./catalina.sh——help
# ./catalina.sh version
# ./catalina.sh start
# ./catalina.sh stop
# ss -tanlp查询端口

Set soft links to start the service and start the service

# ln -s /usr/local/tomcat/bin/catalina.sh /usr/lib/systemd/system/tomcat

# systemctl start tomcat

The establishment of system users

# useradd -r tomcat 
# chown -R tomcat.tomcat /usr/local/tomcat
# su - tomcat -c '/usr/local/tomcat/bin/catalina.sh start'   指定tomcat运行进程
# su - tomcat -c '/usr/local/tomcat/bin/catalina.sh stop '   指定tomct停止进程
# ps -ef | grep tomcat
# ss -tanlp

Guess you like

Origin www.cnblogs.com/pansn/p/11440922.html