Installing Apache Tomcat On CentOS 7

Below are the steps.

1.  Install OpenJDK for java as below.

# yum install java-1.8.0-openjdk -y

2.  Check Java

# which java

# java -version
openjdk version "11.0.12" 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

3. Set JAVA Class Path.

# JAVA_HOME=/usr

# export JAVA_HOME

Also add this in your .bash_profile file so that at next login the class path sets automatically.

4. Download Tomcat

# wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz

5. Expand the zip file

# tar -xvzf apache-tomcat-9.0.53.tar.gz

# mv apache-tomcat-9.0.53 /usr/local

6.  Start Tomcat using following command.

# /usr/local/apache-tomcat-9.0.53/bin/startup.sh

7.  Check status of Tomcat using lsof command as below.

# lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 1416 root 56u IPv6 18296 0t0 TCP *:webcache (LISTEN)

8.  Also check Tomcat using Web http://xxxxx:8080

Where xxxxx is ip of your server.

That’s All Folks !