January 20, 2010

Installing Tomcat 6 on Ubuntu 9.10 - Full guide

The following is a step by step guide for installing Tomcat 6 on my Linode VPS Hosting running Ubuntu 9.10.

If you are like and and trying to use apt-get install tomcat6 and had issues running tomcat correctly this is how i fixed it...

Install Java 6

make sure you are running sun's java not openjdk by typing the following

root@krysto:~# java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
if not then you will need to remove the open JDK by typing the following
apt-get remove openjdk-6-jre

Note: that out of the box Ubuntu will not let you install Sun's Java. You will need to add the multiverse package source.

vi /etc/apt/sources.list
then add the following lines to the file.
deb intrepid main restricted
deb intrepid multiverse
now you should be able to install java

sudo apt-get install sun-java6-jdk

your installed packages should look like
root@krysto:~# dpkg -l | grep java
rc ca-certificates-java              20090928                      Common CA certificates (JKS keystore)
ii  java-common                       0.30ubuntu5                   Base of all Java packages
ii  sun-java6-bin                     6-10-0ubuntu2                 Sun Java(TM) Runtime Environment (JRE) 6 (ar
ii  sun-java6-jdk                     6-10-0ubuntu2                 Sun Java(TM) Development Kit (JDK) 6
ii  sun-java6-jre                     6-10-0ubuntu2 

Installing Tomcat

if you installed tomcat using apt-get then type the following to remove it

apt-get remove tomcat6-admin tomcat6-user tomcat6-docs tomcat6-examples tomcat6

tar xvzf apache-tomcat-6.0.20.tar.gz
mv apache-tomcat-6.0.20 tomcat
mv tomcat /var/

vi ~/.bashrc
more soon...