Tomcat5.5 and Apache2 on Ubuntu 8.04 Hardy Heron

Getting Tomcat and Apache working together isn’t very complicated as long as you know what to do!


  1. Enable multiverse repository
  2. sudo apt-get install sun-java6-jdk apache2
  3. sudo apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps libapache2-mod-jk
  4. sudo /etc/init.d/apache2 restart
  5. sudo /etc/init.d/tomcat5.5 restart


If you get an access error from the Tomcat test, it can usually be fixed by re-installing the sun java6 jdk, performing the Tomcat config below, and then restarting Tomcat: sudo apt-get install –reinstall sun-java6-jdk

Configure Tomcat

sudo nano -w /etc/tomcat5.5/tomcat-users.xml

<role rolename=”admin” />
<role rolename=”manager” />
<role rolename=”tomcat” />
<user username=”tomcat” password=”tomcat” roles=”tomcat” />
<user username=”root” password=”password” roles=”admin,manager,tomcat” />

sudo /etc/init.d/tomcat5.5 restart

Configure Apache to Tomcat Bypass

sudo cp /etc/libapache2-mod-jk/ /etc/apache2/
sudo nano -w /etc/apache2/



sudo nano -w /etc/apache2/mods-available/jk.conf

# Where to find
# Update this path to match your conf directory location (put next to httpd.conf)
JkWorkersFile /etc/apache2/

# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm

# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel info

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /admin/* ajp13_worker
JkMount /manager/* ajp13_worker

sudo ln -s /etc/apache2/mods-available/jk.conf /etc/apache2/mods-enabled/jk.conf
sudo /etc/init.d/apache2 restart

Final Tests:

This entry was posted in java, linux, planet-ubuntu-users, tech. Bookmark the permalink.