Posts Tagged ‘Tomcat’

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
$ wget <download url>
download url –

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
sh /usr/local/tomcat/bin/
sh /usr/local/tomcat/bin/
sh /usr/local/tomcat/bin/
sh /usr/local/tomcat/bin/
echo "Usage: $0 {start|stop|restart}"
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
tomcatmachine – servername or ip address of the machine where the tomcat was just setup.