How to Install and Configure Apache Tomcat on Ubuntu!!!
Apache Tomcat is a servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a “pure Java” HTTP web server environment for Java code to run.
Installing and configuring Tomcat on Ubuntu is very easy.
Before starting you need the Java Development Kit (JDK) and not Java Runtime Environment (JRE). Download it from http://java.sun.com as a .bin file and install it on your system or use the command line:
sudo apt-get install sun-java6-jdk
1. Download and install the Tomcat packages (run in terminal):
sudo apt-get install libapache2-mod-jk libservlet2.4-java libtomcat5.5-java tomcat5.5 tomcat5.5-admin tomcat5.5-webapps
2. Open the .bashrc file (run in terminal):
sudo gedit ~/.bashrc
3. Add the following line in the opened file:
save and close the file.
4. Now make the Logs directory writeable (run in terminal):
sudo chmod -R 777 /var/lib/tomcat5.5/logs
5. To make Tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.
sudo gedit /etc/init.d/tomcat
Now paste in the following:
# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
case $1 in
You’ll need to make the script executable by running the chmod command:
sudo chmod 755 /etc/init.d/tomcat
The last step is actually linking this script to the startup folders with a symbolic link. Run the following commands and we are ready.
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
6. To start the tomcat, run the following command:
7. You can test to see if it’s working, point your browser at:
A word of precaution: It’s better to avoid running Tomcat as root.
There are many other setting within Tomcat, I think the user should better try them out themselves. Some are:
1) Making Tomcat to run on port 80.
2) Turning off Directory Listings like Index Manager.
3) Check out the Tomcat configuration file and try out something of your own. Only precaution required is that you should not be logged in as root