How To install tomcat6 sever in Linux in Ubuntu

In my vacation last month i was assigned a project. The project was about bug fixing in a web application. So i had to install some of the basic tools - server, jdk and some others. I chose tomcat6 as my server and went on to install. This post is basically for the beginners. So i am going to keep it very simple.

The one simple method available for Ubuntu users is installing through the Synaptic Packet Manager. 
You can find this tool at  System > Admistration.

Searching for tomcat you will see something like the above screenshot. Just right click on the main tomcat6 and mark for installation. Then click on Apply to install. 

To start the server type the following command in the terminal.
sudo service tomcat6 start

Now goto your browser and type http://localhost:8080/. You will see a message like "It Works" if the tomcat is up and running. 

The problem i found with this type of installation was finding the server directory. When installing through synaptic the application files are distributed in various folder. If the library files are in /var/lib/tomcat directory config files will be put in /usr folder. This becomes a problem you want to connect tomcat to eclipse. The solution to this is the manual install of tomcat!

First download the tar.gz binary distribution file from Next follows some simple commands to be executed to setup tomcat.
  1. Move the tar.gz file to /usr/local/src and extract it. You can either simply right click the file and click on extract or type the following commands in the terminal.
tar xzvf file_name.tar.gz
tar xjvf file_name.tar.bz2

    2.   Now you have to setup the environmental variables. Use the following commands.

cat >> ~/.bashrc
export CATALINA_HOME=/usr/local/src/tomcat6
export JAVA_HOME=/usr/lib/jvm/java-6-sun
Press ctrl+d to save and then 
source ~/.bashrc
Now to start/shutdown the server goto the terminal and type
sudo $CATALINA_HOME/bin/
sudo $CATALINA_HOME/bin/
So using the manual method of installation you can now have all the files of  tomcat in a single directory making things simpler.
Category: , , , ,


Willie Sager said...

Thanks for such a nice and updated information. I got some interesting tips from this post.
Sony Laptops

Post a Comment