Complete steps for installing and configuring Tomcat on Linux systems

Tip: Configuring Tomcat installation jdk environment needs to be configured, so the environment is not configured jdk friends, first install JDA


1. Download the Tomcat installation package of your required version

Visit the Apache Tomcat official website and select the version of tomcat you need ( Tomcat 9.0.43 Released is selected here ), click the corresponding Download button, and select the tar.gz installation package under Core to download (if the speed is slow or you cannot access the website, go USTC domestic open source mirror to download the version you need).

After the download is successful, send the installation package to the server via the command line scp ./Users/tinghs/Downloads/apache-tomcat-9.0.43.tar.gz [email protected]:/root/software.

2. Unzip the Tomcat installation package

Run the following command, you can modify the installation path and jdk installation package name according to your needs.

[root@tinghs software]# mkdir -p /usr/local/tomcat
[root@tinghs software]# tar -zxvf apache-tomcat-9.0.43.tar.gz -C /usr/local/tomcat

3. Set environment variables

Run the command below to set environment variables.

[root@tinghs software]# vi /etc/profile

Use Shift + Gto reach the end of the file, click I, add the following configuration, and modify the path of CATALINA_HOME according to the actual situation:

export  CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.43
export  PATH=$CATALINA_HOME/bin:$PATH

Use to Escend editing, use to :qwsave and exit the file.


4. Execute the profile file

Execute the profile file to make the environment variables take effect.

[root@tinghs software]# source /etc/profile

5. Test whether tomcat can run normally

[root@tinghs software]# cd /usr/local/tomcat/apache-tomcat-9.0.43/bin/
[root@tinghs bin]# ./startup.sh

When Tomcat started appears, it means that Tomcat has been started successfully, you can use IP:8080 to access it and try it.

Note: If you cannot access it, it may be due to the fire prevention of the server. You can try to run the following command to release the firewall port, and then try again:

# 放开8080端口
firewall-cmd --permanent --zone=public --add-port=8080/tcp  
# 重载防火墙配置,使上一行命令生效
firewall-cmd --reload  
# 测试端口是否已经放开
firewall-cmd --zone=public --query-port=8080/tcp 

Attachment: You can check the running status with the following command:

# 根据关键字查看进程
ps -aux | grep tomcat
# 查看端口使用状况
netstat -nalp | grep 8088
# 无法识别 netstat 命令时可以通过以下命令进行下载 
yum install net-tools 
# 监听日志输出 
cd /usr/local/tomcat/apache-tomcat-9.0.43/logs/
tail -f catalina.out

Guess you like

Origin blog.csdn.net/baidu_41847368/article/details/114320422