How to install Apache Tomcat 7 on Ubuntu Server 12.4 LTS

Today I successfully installed Tomcat 7 on Ubuntu Server 12.4 LTS with the following commands (executed as root):

apt-get install default-jdk
apt-get install tomcat7
apt-get install tomcat7-admin
apt-get install tomcat7-examples

After that I added the following to /etc/tomcat7/tomcat-users.xml:

<tomcat-users>
  <role rolename="admin-gui"/>
  <role rolename="manager-gui"/>
  <user username="admin" password="admin" roles="admin-gui,manager-gui"/>
</tomcat-users>

And restarted Tomcat:

service tomcat7 restart

So I login to manager webapp and host-manager webapp with “admin/admin”.

By default, when I navigate to <hostname>:8080 in my browser Tomcat shows the following page:

Apache Tomcat 7

Notes

“default-jdk” installed Java version “1.6.0_27” to /usr/lib/jvm/default-java so I can add the following commands to my ~/.bashrc:

export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=/usr/share/tomcat7

*.war files should be placed in /var/lib/tomcat7/webapps, see http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html for more information.

Version of my Linux kernel is “Linux ubuntu 3.2.0-43-generic”. Do not forget to update your server if something does not install.

Leave a Reply

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