Apache Tomcat® software is an open-source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket specifications are developed under the Java Community Process.

In this guide, we will install Apache Tomcat on a Centos 7 server.

Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can easily deploy your own cloud servers.

Once you have signed up, log into your Cloudwafer Client Area with the password provided in your mail and deploy your Cloudwafer cloud server.

Updating System Packages
It is always recommended that you update the system to the latest packages before beginning any major installations. This is done with the command below:

sudo yum update

Step 1: Install OpenJDK
One of the core requirements needed by Tomcat is Java JDK. Hence we are going to install this using the YUM tool from the EPEL repository. Issue the command below to install OpenJDK:

sudo yum install epel-release
sudo dnf install java-1.8.0-openjdk.x86_64

You can check your Java version by issuing the command below:

java -version

Step 2: Download Tomcat Packages
We can now download the official Tomcat Package from the Tomcat 9 Software Download webpage At the time of writing this guide the latest version of the 9 series is 9.0.35.

cd /usr/local
sudo wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.35/bin/apache-tomcat-9.0.35.tar.gz

Next, extract the downloaded file as shown below:

sudo tar -xvf apache-tomcat-9.0.35.tar.gz

Next, rename the extracted file as shown below:

sudo mv apache-tomcat-9.0.35 tomcat9

Step 3: Starting the Tomcat Service
Before we proceed to this step, we need to configure CATALINA_HOME environment variable in our system using the following command:

echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc
source ~/.bashrc

After our configuration, Tomcat provides scripts which we'll use to start the tomcat web server:

sudo sh /usr/local/tomcat9/bin/startup.sh

You can now visit your domain or IP address on port 8080 on port 8080 as shown below: cloudwaferlabs.com.ng:8080