Setting up Tomcat 7 on linux


To install tomcat 7 you must be having JDK installed on your system.

So for that you can download and install JDK from here.
Alternatively for debian based systems(like ubuntu,mint) you can also fire this command to install JDK:

sudo apt-get install sun-java6-jdk  

Now to install tomcat follow these steps:

1) To download and extract tomcat package fire these commands:


tar xvzf apache-tomcat-7.0.23.tar.gz

You can also download and install tomcat package manually from the above link. 

2) Now we'll move this extracted files to some permanent location. For that fire following command.

 sudo mv apache-tomcat-7.0.23 /usr/local/tomcat 

This command will move files to /usr/local/tomcat directory. You can choose any other location also because it's linux and it's not rigid like windows...;) :) .

3) Now to use tomcat we also need to set JAVA_HOME environment variable. For that fire following command .

gedit ~/.bashrc 

This command will open .bashrc file in gedit. You can use any other editor than gedit also. 

Now at the end of the opened file add following lines:

export JAVA_HOME=/usr/lib/jvm/java-6-sun  

Here /usr/lib/jvm/java-6-sun is the path of JDK. Make sure that you change it if you are using a different version of JDK.

Now we are done with installation part.
To start tomcat execute file from tomcat/bin directory.

To chec whether tomcat is working or not open browser and try to access localhost on port 8080 by writing following in addressbar.

It should show up with tomcat welcome page as shown in below snapshot.

Leave comments for any trouble and suggestions....:) 

You may also like

Popular Posts