Install Tomcat 7 on ubuntu 14.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 7 on ubuntu 14.04 Server

From the terminal and run the following command

sudo apt-get install tomcat7 tomcat7-docs tomcat7-admin tomcat7-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 tomcat7 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/tomcat7/tomcat-users.xml file

sudo vi /etc/tomcat7/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/tomcat7/tomcat-users.xml

In /var/lib/tomcat7 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/tomcat7/server.xml file

sudo vi /etc/tomcat7/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/tomcat7 restart

Sponsored Link

You may also like...

Leave a Reply

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