Setting up Tomcat 6 in Ubuntu 10.04

Posted: September 14, 2010 in HowTo
Tags: , , , ,

Ubuntu Server: 10.04 LTS
Tomcat: 6.0.29

Step 1: Download apache-tomcat-6.0.29.tar.gz from http://tomcat.apache.org/
$ wget <download url>
download url – http://apache.technocozy.com//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz

Step 2: Extract the tar file
$ tar xvf apache-tomcat-6.0.29.tar.gz

Step 3: Copy the extracted contents to /usr/local
$ sudo cp apache-tomcat-6.0.29.tar.gz /usr/local

Step 4: Create a softlink as tomcat
$ sudo ln -s apache-tomcat-6.0.29.tar.gz tomcat

Step 5: Add tomcat user
useradd -d /home/tomcat -s /bin/bash -m tomcat

Step 6: Change permissions to tomcat
$ sudo chown -R tomcat:tomcat /usr/local/apache-tomcat-6.0.29.tar.gz
$ sudo chown -R tomcat:tomcat /usr/local/tomcat

Step 7: Setup users in tomcat
$ cd /usr/local/tomcat
$ sudo vi conf/tomcat-users.xml
Add the following
<role rolename="tomcat"/>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="admin" password="admin" roles="admin,manager"/>

Step 8: Setup start/stop scripts
$ sudo vi /home/tomcat/tomcat
Add the following
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0

Change permissions on tomcat script
$ chmod ug+x tomcat

Step 9: Start/Stop/Restart Tomcat
To start
$ ./tomcat start

To stop
$ ./tomcat stop

To restart
$ ./tomcat restart

Step 10: Test setup
After starting tomcat, go to Internet browser and type in
http://<tomcatmachine&gt;:8080
tomcatmachine – servername or ip address of the machine where the tomcat was just setup.

Advertisements
Comments
  1. Rini says:

    Very usefull and simple,,
    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s