Tag Archives: install tomcat on centos 7

How To Install Tomcat on CentOS 7

Hi there,

This short tutorial will show you how to install Tomcat 7 on CentOS 7.

“The Apache Tomcat® software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.”

The steps that you need to follow are detailed below. Just copy and paste them into your CentOS 7 server and all should work. If not please do comment below and I will respond as soon as I can.

First we need to download Tomcat:

  • sudo yum install tomcat

Now we will edit the tomcat.conf file, enter the below command to you CentOS machine:

  • sudo vi /usr/share/tomcat/conf/tomcat.conf

Now appened the below line to the end of the file.

JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx1026m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"

Next we’ll install the web application manager and the documentation, run the two following commands:

  • sudo yum install tomcat-webapps tomcat-admin-webapps
  • sudo yum install tomcat-docs-webapp tomcat-javadoc

Now we’ll edit the user.xml file to allow use to get into the web manger application, enter the following command:

  • sudo vi /usr/share/tomcat/conf/tomcat-users.xml


Next add this line between the <tomcat-users> Tags.

<user username="admin" password="password" roles="manager-gui,admin-gui"/>

Note the username and password, we will need this shortly.

Enter the two following commands to start the service and to ensure that the service is started when Centos powers on

  • sudo service tomcat start
  • sudo chkconfig tomcat on

Now, open a browser and navigate to localhost over port 8080

  • https://localhost:8080

you should see Tomcat running:

Now click Manager app

Enter the following details:

  • Username: admin
  • Password: password

You are now in the Web application manager.