How to install Tomcat in Centos server
The Apache Tomcat software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.
This article explains the detailed steps to install Tomcat in Centos server.
Step1: Check Java version
Ensure java is installed in the server. JAVA SE 7 or 8 version should installed in your system. Currently, Java 9 does not support Tomcat.
# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Step2: Download Tomcat 7
#wget http://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.88/src/apache-tomcat-7.0.88-src.tar.gz
Step3: Extract downloaded archive
#tar -xzf apache-tomcat-7.0.88-src.tar.gz
Step4: Move the tomcat folder
#mv apache-tomcat-7.0.88-src /usr/local/tomcat7
Step5: Change the location to Tomcat folder
#cd /usr/local/tomcat7
Step6: Start Tomcat Server
#./bin/startup.sh
Sample Output:
Using CATALINA_BASE: /usr/local/tomcat7
Using CATALINA_HOME: /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME: /opt/jdk1.8.0_121
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started.
Step7: Access Tomcat in Browser
Tomcat server works on port 8080 default. We can access the same in the following url.
http://serverip:8080
Here we need to replace serverip with the ipaddress of the server.
Step8: Stop Tomcat Server
We can use the following command to stop the Tomcat service if needed.
#./bin/shutdown.sh
That's all......