Linux installation tomcat tutorial

foreword

 PS: To install tomcat, you need to configure jdk first

1.Tomcat download

1.1.Tomcat installation package download

1. You can choose to download directly from Apache Tomcat® - Apache Tomcat 9 Software Downloads on the omcat official website , and upload it to the linux server

1.2. Host wget source download

It can also be downloaded directly in linux

#Excuting an order  

wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.87/bin/apache-tomcat-8.5.87.tar.gz 

2. Deployment and installation

2.1. Unzip the installation package:

tar -xzvf apache-tomcat-8.5.87.tar.gz 

cd to the decompressed installation path:

cd /home/checkTicket/apache-tomcat-8.5.87 (this path is the path where I store tomcat for reference only)

2.2. Tomcat environment variables tomcat environment variables and configuration

2.2.1. Edit profile file

vi /etc/profile  add tomcat environment variable path

#tomcat environment variable path

export TOMCAT_HOME=/home/checkTicket/apache-tomcat-8.5.87     

 After the configuration is successful, make the file take effect:

source /etc/profile

2.2.2. Configure and modify the Tomcat port

The default port is 8080. Generally, in order to avoid port process access conflicts, we can modify the port for access, for example as follows:

cd /home/checkTicket/apache-tomcat-8.5.87/conf

vi server.xml

    <Connector port="8185" protocol="HTTP/1.1"
               connectionTimeout="20000" 
               redirectPort="8445" />

3. Start Tomcat

Enter the bin directory

start up:

sh startup.sh  or  ./startup.sh

stop:

sh shutdown.sh  or  ./shutdown.sh

Check whether the startup is successful:

ps -ef|grep tomcat

The startup is successful, and the query process is as follows:

4. Access verification

Browser access: http://IP:port/

5. Supplementary instructions

Pay attention to the host firewall, whether to intercept the Tomcat port, or check the startup log, whether an error is reported

service iptables status View firewall status
service iptables start open firewall
service iptables stop close firewall
service iptables restart restart firewall

systemctl start firewalld starts the firewall

systemctl stop firewalld disables the firewall

​​​​​​​​systemctl enable firewalld set boot

​​​​​​​​systemctl disable firewalld permanently closes the firewall

systemctl status firewalld View fire status

 

Guess you like

Origin blog.csdn.net/qq_20957669/article/details/130077577