How To Install Apache Tomcat on Linux(Redhat/Ubuntu)?

What is Apache tomcat?

Ans: An ApacheTomcat is an open source web application server which supports J2ee Servlets, JavaServer, Pages (JSP) and API's. Tomcat should not be confused with Apache web server which an HTTP web server.
–From Wikipedia.

Some terminology about Apache tomcat.

An Apache Tomcat can be configured by editing server.xml file. This server.xml file of Tomcat can take as  synonyms to httpd.conf file for Apache web server.

Servlet is defined as a way add dynamic content to a Web server using the Java platform. A servlet container is a compiled, executable program. The servlet container name of Tomcat is called as Catalina.

Prerequisite for Apache tomcat are

  1. java
  2. JDK

Step by step for installing Apache tomcat

Note: Avoide installing tomcat from repositories, always prefer to install it from source downloaded from Apache site.

Step1: Install all the prerequisites


	#yum install java


	#apt-get install java

Step2: Download tomcat source package and uncompress it.


	#cd /opt
#tar xvfz apache-tomcat-6.0.29.tar.gz

Step3: Setup the paths for Catalina and others.

Setting catalina paths in Redhat/Ubuntu Linux


Setting java paths

Check what java versions are installed in your system

	#update-alternatives --config java

This command will display default java version information used in your machine.

Example output :

	# update-alternatives --config java

There are two programs which provide 'java'.

	Selection Command
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java

Enter to keep the current selection[+], or type selection number:

If you see above the default java version is 1.6 so set the path to /usr/lib/jvm/jre-1.6.0-openjdk (* indicates the default version). Now set the path as shown below.


Step4: Now start tomcat server


Sample output.

	Using CATALINA_BASE: /opt/apache-tomcat-5.5.26
Using CATALINA_HOME: /opt/apache-tomcat-5.5.26
Using CATALINA_TMPDIR: /opt/apache-tomcat-5.5.26/temp

Step5: By default Apache Tomcat will be hosted on localhost : 8080 port by default. So try to access the site with your favorite web browser


Stay tuned to other posts about troubleshooting tomcat installation.

Please visit for more linux admin stuff.

Show your love by sharing this..!
Share on VKShare on StumbleUponShare on YummlyPrint this pageFlattr the authorShare on TumblrEmail this to someoneBuffer this pageShare on Google+Share on LinkedInShare on FacebookTweet about this on TwitterPin on PinterestShare on RedditDigg this
The following two tabs change content below.
My name is Surendra Kumar Anne. I hail from Vijayawada which is capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. I work with ICE systems, Sydney as Sr. Consultant. You can contact me at surendra (@) linuxnix dot com.
  • Independence 2007

    thanks you for sharing this…

  • Valarmathiv

    Thanks a lot for this post

    • Surendra

      Wlcom Mathiv,

      Please let me know if you want to see any other things related to Linux stuff..!

  • Priya

    Very good post with step by step details. Thanks.

    • Surendra

      Glad it helped you..!

  • vishal

    thanks a lot for these details..can u please give some details about each configuration parameter which are available in server.xml in conf folder. thanks in advance

  • REDHAT User

    thanks bro.

  • Tasneem

    Thanx a lot

  • prabhuarem

    Surendra .. I really admire your site.. You rock always.. Glad to have you maintaining this site.

  • prakash rath

    good steps for installtion

  • Sat

    Hi surendra,

    Can you please help us in installing the apache tomcat in the windows box too.. with windows service and without windows service..please…

    Thanks In advance !!

  • http://Indmax Jagan

    HI surendra,

    i followed above steps but unable to get through browser (http://localhost:8080)..what could be the reason


    • Surendra Anne

      can you check errors in your apache logs if you can find any info?

  • sonu adminstrator

    i followed above steps but unable to get through browser
    Very good post with step by step details. Thanks.

    • Surendra Anne

      Hi Sonu,

                    Can I know what is the error you are facing?



      • sonu adminstrator

        Do you have your directory structure under classes declared as a package in your java class?

        In your example, you should have the classes under cal being devlared as a package called cal.

        I hope this helps. Good luck.

  • ganeshn1411
  • Sasha Jumpow

    Step 4: Error in name, must be


    • Surendra Anne

      Thanks for headsup. Updated the post