Apache Tomcat is an open-source web server similar to httpd server, but tomcat is basically used to host Java applications like (JSP and java servlet). To deploy an application in tomcat, you will first have to create a WAR file and then deploy that WAR file on your tomcat directory named web apps.
Therefore this article will help you to install apache tomcat on any Linux servers
Step-1: Before Installing tomcat, you should have java installed on your server, and the environment variables should also be set.
To Check If java is installed on your server just type the command
# javac
or
# java -version //to check the java version
Step 2: Download the apache tomcat Archive using the following command:-
# cd /opt
# wget https://vexplains.com/apache-tomcat-8.5.23.tar.gz
After Downloading extract the archive in the /opt directory using the following command:-
# tar xzf apache-tomcat-8.5.23.tar.gz
Step 3: Start tomcat server
To start the tomcat server is very simple just run the following command as follows:-
# cd /opt/apache-tomcat-8.5.23
# ./bin/startup.sh
Step 4: Check tomcat on web server
By default, tomcat start on port 8080. To access Tomcat on the web browser just type your server IP followed by the port number.
http://server-ip:8080
Step 5: To stop tomcat server
To Stop tomcat server just run the following command:-
# ./bin/shutdown.sh
Hope all these steps will help you setting up the tomcat server.