How to install Tomcat 6 on Ubuntu

On 10.04 you can just install the tomcat6 package.

This was tested on Ubuntu Server 8.04.

Install java environment

$ sudo apt-get install sun-java6-bin sun-java6-jdk sun-java6-jre 

Add the following to your bashrc files

The following are all locations you could place the export in. I suggest the global /etc/bash.bashrc and the .bashrc file in your home directory.

  • /home/username/.bashrc
  • /home/username/.bash_profile
  • /etc/bash.bashrc
export JAVA_HOME=/usr/lib/jvm/java-6-sun

Download Tomcat

Download Tomcat 6 here » or download it directly at,

http://apache.opensourceresources.org/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz »

The following is only my preference, so you can place Tomcat anywhere.

Unzip tomcat, and move the tomcat directory to /usr/local.

$ tar -zxvf apache-tomcat-6.0.20.tar.gz -C /usr/local
$ mv /usr/local/apache-tomcat-6.0.20 /usr/local/tomcat6.0.20

Create a startup script,

# file: /etc/init.d/tomcat6
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
    sh /usr/local/tomcat6.0.20/bin/startup.sh
    ;;
stop)  
    sh /usr/local/tomcat6.0.20/bin/shutdown.sh
    ;;
restart)
    sh /usr/local/tomcat6.0.20/bin/shutdown.sh
    sh /usr/local/tomcat6.0.20/bin/startup.sh
    ;;
esac   
exit 0

Set the execute permissions on the file

$ chmod 755 /etc/init.d/tomcat6

Auto start tomcat on system reboot

$ sudo ln -s /etc/init.d/tomcat6 /etc/rc1.d/K99tomcat
$ sudo ln -s /etc/init.d/tomcat6 /etc/rc2.d/S99tomcat

Open port 8080 on your router via port forwarding

See your firewall or router for instructions.

Start Tomcat

$ sudo /etc/init.d/tomcat6 start

How to deploy an applicaton

See Deploy an application in tomcat.

Reference

http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/ »

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.