Install Tomcat 8 on ubuntu 16.04 Server

Sponsored Link
Apache Tomcat (or simply Tomcat, formerly also Jakarta Tomcat) is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle, and provides a "pure Java" HTTP web server environment for Java code to run in. In the simplest config Tomcat runs in a single operating system process. The process runs a Java virtual machine (JVM). Every single HTTP request from a browser to Tomcat is processed in the Tomcat process in a separate thread.

Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files

Install Tomcat 8 on Ubuntu 16.04 Server

From the terminal and run the following command

sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples

Answer yes at the prompt to install tomcat. This will install Tomcat and its dependencies, such as Java, and it will also create the tomcat8 user. It also starts Tomcat with its default settings.

the default splash page by going to your domain or IP address followed by :8080 in a web browser:

http://your_ip_address:8080

You will see a splash page that says "It works!", in addition to other information.

Tomcat Web Management Interface

To enable admin web based features you need to do the following,Edit /etc/tomcat8/tomcat-users.xml file

sudo vi /etc/tomcat8/tomcat-users.xml

Add the following lines


<role rolename="manager"/>
<role rolename="admin"/>
<user name="admin" password="secret_password" roles="manager,admin"/>

Save and exit the file

You should be able to see your manage page here http://your_ip_goes_here:8080/manager/html.Log in with the name and password you just set in /etc/tomcat8/tomcat-users.xml

In /var/lib/tomcat8 directory you should see these directories conf, logs, webapps, work.Webapps is where your servlets will go ( or at least a xml file that points to them)

As a test download this war file http://simple.souther.us/SimpleServlet.war and then use the tomcat management page and select war file to deploy ( in teh deploy section) to upload this file to your server.Optionally just wget http://simple.souther.us/SimpleServlet.war directly to the webapps folder tomcat should recognize the war file and expand it with everything you need.

Now browse to http://serverip:8080/SimpleServlet/

Change tomcat server to run on port 80

If you want to Change tomcat server to run on port 80 follow this procedure

You need to edit the /etc/tomcat8/server.xml file

sudo vi /etc/tomcat8/server.xml

Now replace the part that says Connector port=”8080″ with Connector port=”80″

Save and exit the file

Restart tomcat server with the following command

sudo /etc/init.d/tomcat8 restart

Sponsored Link

You may also like...

4 Responses

  1. David says:

    How can I make tomcat 8 start at boot?

  2. EvgenyVart says:

    To enable admin web based features you need to do the following,Edit /etc/tomcat8/tomcat-users.xml file
    –sudo vi /etc/tomcat8/tomcat-users.xml
    Add the following lines

  3. EvgenyVart says:

    role rolename=”tomcat”
    user username=”tomcat” password=”tomcat” roles=”tomcat, manager-gui”

  4. David says:

    If I install tomcat via sudo apt-get install … I don’t get the service file under /etc/init.d/.

Leave a Reply

Your email address will not be published. Required fields are marked *