How To Install Tomcat 8 On CentOS 7

Share this Article: Facebook0Google+0Twitter16LinkedIn0Reddit0StumbleUpon1

From the Apache Tomcat home page,

Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process. Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations.

Install Java 1.7 or higher

yum install java-1.7.0-openjdk.x86_64  -y

java  -version
java version "1.7.0_65"
OpenJDK Runtime Environment (rhel- u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
[root@unixmen-centos7 bin]#

Download latest Tomcat 8 release

[root@unixmen-centos7 ~]# cd /opt
[root@unixmen-centos7 opt]# wget

Extract it using command:


Move the extracted contents to /opt/ directory.

mv apache-tomcat-8.0.9/ /opt/tomcat

Setup Tomcat environment variable

Create a file called under /etc/profile.d/ directory.

vi /etc/profile.d/
#Add the following contents:

export CLASSPATH=.

Save and close the file. Make it executable using the following command.

chmod +x /etc/profile.d/

Then, set the environment variables permanently by running the following command:

source /etc/profile.d/

Now, we have to start the Tomcat server. Before starting Tomcat, give executable permission to the following script files.

chmod +x $CATALINA_HOME/bin/
chmod +x $CATALINA_HOME/bin/
chmod +x $CATALINA_HOME/bin/

Start Tomcat server by running the following command from your Terminal.


[root@unixmen-centos7 bin]# ./
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@unixmen-centos7 bin]#

Check if tomcat listening:

[root@unixmen-centos7 bin]# netstat -an | grep 8080
tcp6 0 0 :::8080 :::* LISTEN

Add the port to the firewall and reload:

[root@unixmen-centos7 bin]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
[root@unixmen-centos7 bin]# firewall-cmd --reload

Add the users and the roles under conf/tomcat-users.xml:

 <role rolename="manager-gui"/>
 <role rolename="manager-script"/>
 <role rolename="manager-jmx"/>
 <role rolename="manager-status"/>
 <role rolename="admin-gui"/>
 <role rolename="admin-script"/>
 <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

Restart Tomcat:

./bin// stop
./bin// start

Check http://ip:8080.


Tomcat tomcat-admin Tomcat-manager

For questions please refer to our Q/A forum at :

Share this Article: Facebook0Google+0Twitter16LinkedIn0Reddit0StumbleUpon1