Install Tomcat 5.5 in Debian and Ubuntu

, ,

1. Necessary packages
apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps


2. Directories
/usr/share/tomcat5.5/
/usr/share/tomcat5.5-webapps/
/etc/tomcat5.5
/var/lib/tomcat5.5
/var/log/tomcat5.5


3. Remember to export JAVA_HOME, for example (put in .bashrc)
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

Launch tomcat5.5 using
sudo /etc/init.d/tomcat5.5 start
sudo /etc/init.d/tomcat5.5 restart


4. Problem: Can't start tomcat5.5 in ubuntu
Here is the solution:
$ cd /usr/share/tomcat5.5/logs 
$ sudo mv catalina.out catalina.out.old
$ sudo touch catalina.out
$ sudo chown tomcat55:nogroup catalina.out 


5. Configuration for using Tomcat Manager (http://localhost:8180/manager/html) and Tomcat Administration (http://localhost:8180/admin).
Edit /usr/share/tomcat5.5/conf/tomcat-users.xml and include the following:
<user username="myname" password="mypassword" roles="manager"/>
<user username="myname" password="mypassword" roles="admin"/>


6. Problem of using Tomcat Administration in Debian
Solution:Add the following to the ‘/etc/tomcat5.5/policy.d/50user.policy’
// to activate the admin-interface
// http://lists.alioth.debian.org/pipermail/
// pkg-java-maintainers/2006-November/009749.html
grant codeBase “file:/usr/share/struts1.2/struts.jar” {
permission java.security.AllPermission;
};


7. Configure webapps
Recently when Debian upgrades tomcat5.5, all webapps configurations are deleted, only admin and manager apps remain in localhost configuration. This is a really annoying behavior for Debian package update. However, Debian update did notice that I changed tomcat-users.xml, 40webapps.policy and 50users.policy, so I had a chance to keep my old configuration.

For restoring all my webapps,
ln -s /usr/share/tomcat5.5-webapps/anywebapp.xml 
/usr/share/tomcat5.5/conf/Catalina/localhost/anywebapp.xml

Gaming in LinuxVim Tips

Comments

Unregistered user Tuesday, October 2, 2007 8:41:02 AM

Martin writes: Hi, great tutorial! I had problems with tomcat and couldnt figure out why. Everything seemed fine when I started it but I couldnt connect. Solution was changing the catalina.out as you explained! Thanks a lot!

Unregistered user Friday, October 19, 2007 10:21:13 AM

Egon writes: Nice summary! Cheers!

Unregistered user Friday, November 9, 2007 1:12:45 AM

Marco writes: There's a small error in step 5 <user username="myname" password="mypassword" roles="manager"/> <user username="myname" password="mypassword" roles="admin'/> should be <user username="myname" password="mypassword" roles="manager"/> <user username="myname" password="mypassword" roles="admin"/> ;)

subjam Friday, November 9, 2007 1:57:01 AM

Hi, Marco,

Thank you for pointing out the typo!

Unregistered user Friday, November 21, 2008 5:12:40 PM

Adam writes: It works, but only if I run Tomcat as root. Since a tomcat55 user is created when I installed Tomcat, I had assumed it would run as that user. Is there any way to have Tomcat run as tomcat55 instead of root?

Unregistered user Friday, May 22, 2009 1:19:43 PM

Rams writes: while installing tomcat, the installation is stopped in jvm.dll please provide any suggestion to install correctly

Unregistered user Sunday, May 31, 2009 1:30:53 PM

ajit writes: great link.thanks...it really worked..

Unregistered user Monday, June 15, 2009 1:16:20 AM

oscar writes: EXCELENT! CHEERS FROM CHILE

Unregistered user Saturday, July 25, 2009 12:49:27 AM

Dave writes: Still Useful! Thanks!

Unregistered user Tuesday, August 18, 2009 7:14:23 PM

ipxmax writes: Excelent!!! Tanx =)

Unregistered user Thursday, January 14, 2010 8:20:53 PM

Anonymous writes: Nice!

Unregistered user Thursday, February 25, 2010 7:00:04 PM

Anonymous writes: Hi all, I installed and Run tomcat 5.5 in Ubuntu without problems. But, when I want to access the administration console I can't. I was trying to add a new role as your tutorial said, but I can't modified the file usr/share/tomcat5.5/conf/tomcat-users.xml I only have one Ubuntu user and I believed that this user has the privileges to do that. Thanks,

Unregistered user Monday, March 8, 2010 10:17:51 PM

David writes: 10/10 - very neat and pithy summary. Many thanks.

Unregistered user Monday, March 15, 2010 4:37:56 AM

taivo writes: nice quick reminder, merci bien!

Unregistered user Tuesday, July 20, 2010 6:58:20 AM

Anonymous writes: very much excellent

Unregistered user Thursday, January 13, 2011 1:12:28 PM

Diego Benna writes: See this link: http://diegobenna.blogspot.com/2011/01/install-tomcat-7-in-ubuntu-1010.html for install tomcat7 on Linux (Ubuntu 10.10 tested)

Unregistered user Friday, February 4, 2011 7:33:15 PM

Anders writes: For Tomcat 6 in Debian and Ubuntu, you should consider unsing the package tomcat6-user when you develop software. I have written a comment on Diego Bennas Blog about this at http://diegobenna.blogspot.com/2011/01/install-tomcat-6-on-ubuntu.html. Basicly you do this to install: sudo aptitude install tomcat6-user tomcat6-admin tomcat6-doc tomcat6-examples Here you create an Tomcat 6 instance. You can make how many you want. export MYTCAT=~/my-test-server tomcat6-instance-create -p 8090 -c 8095 $MYTCAT ln -s /usr/share/tomcat6-admin/manager $MTCAT/webapps ln -s /usr/share/tomcat6-admin/host-manager $MYTCAT/webapps ln -s /usr/share/tomcat6-examples/examples $MYTCAT/webapps ln -s /usr/share/tomcat6-docs/docs $MYTCAT/webapps Edit to get a user in group "manager" $MYTCAT/conf/tomcat-users.xm Now you can start your instance of Tomcat 6 in ~/my-test-server $MYTCAT/bin/startup.sh Then just connect your web browser to http://localhost:8090/doc http://localhost:8090/examples http://localhost:8090/manager/list http://localhost:8090/host-manager/list If you want to run this from NetBeans, you set CATALINA_HOME to /usr/share/tomcat6 and CATALINA_BASE to $MYTCAT (~/my-test-server in this case). If you want to run a Tomcat6 server when you boot your machine (the deployment server for the program), you should install this. sudo aptitude tomcat6 authbind apache2 libapache2-mod-jk And then set up apache2 with a2enmod and a2ensite as usual. For more info: zmore /usr/share/doc/apache2.2-common/{NEWS,README}.Debian.gz Happy hacking!

Unregistered user Thursday, February 10, 2011 9:00:44 AM

Анонімний writes: недорогая реклама в прессе, СМИ, на тв Киеве

Unregistered user Tuesday, May 10, 2011 2:52:27 PM

frei writes: Спасибо, почему-то думал что томкет перезагружается вместе с апачем, оказалось нет, чтобы настройки всупили в силу нужно отдельно перезагружать tomcat: sudo /etc/init.d/tomcat6 start sudo /etc/init.d/tomcat6 restart

Unregistered user Monday, August 1, 2011 12:12:27 PM

fat bold cyclop writes: 2001 and your tips still work! "6. Problem of using Tomcat Administration in Debian" was really killing me.. Thanks a lot!

Write a comment

New comments have been disabled for this post.