Installing Tomcat 7 on Ubuntu 10.04
After one have installed JDK 6 then do following steps to install Tomcat 7
wget http://apache.dataphone.se/tomcat/tomcat-7/v7.0.12/bin/apache-tomcat-7.0.12.tar.gz tar xvfz apache-tomcat-7.0.12.tar.gz sudo mv apache-tomcat-7.0.12 /usr/local/tomcat7
For autostart create following script in /etc/init.d
sudo vi /etc/init.d/tomcat7
Paste in the following
# Tomcat auto-start
#
# description: Auto-starts tomcat 7
# processname: tomcat7
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat7/bin/startup.sh
;;
stop)
sh /usr/local/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat7/bin/shutdown.sh
sh /usr/local/tomcat7/bin/startup.sh
;;
esac
exit 0
Save the file and set executable permissions
sudo chmod 755 /etc/init.d/tomcat7
Link the startup script to startup folders
sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat
Finally test to start
sudo /etc/init.d/tomcat7 start
Now open url http://yourserver.com:8080/
Almost the complete description of this installation was taken from the blog post http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/ but adapted to Tomcat 7. It turns out that it works perfectly for Tomcat 7 as well as Tomcat 6.
It might seem as a bit unnecessary to duplicate most of the steps from an already existing blog post. However this is more for my own reference and on occasion blogs and useful posts disappear.