As of date there isn't an apt-get package for Installing tomcat7 on Ubuntu. So you need to Install it manually. Its easy... all you have to do is follow some simply steps which are listed below:
Assuming you already have JRE/JDK Installed on your Ubuntu box, we will straightaway jump to Installing tomcat....
1. Download the package (tar.gz) from: http://mirrors.axint.net/apache/tomcat/tomcat-7/v7.0.19/bin/apache-tomcat-7.0.19.tar.gz
As of writing this post this is the latest one...
2. Unpack the downloaded file: you can use the command
tar xvzf apache-tomcat-7.0.19.tar.gz
3. Now we will move everything to a more meaniningful directory.. like tomcat7.. so here is what you need to do:
sudo mv apache-tomcat-7.0.19/ /usr/share/tomcat7
4. Modify catalina.sh so that it points to the correct JRE you want to use... This file can be found in /usr/share/tomcat7/bin
5. Just insert JAVA_HOME and JRE_HOME after the first line.
That's all you had to do... You can try running it with following command and check...
sudo /usr/share/tomcat7/bin/startup.sh
The output shall tell the various things like:
Using CATALINA_BASE: /usr/share/tomcat7Using CATALINA_HOME: /usr/share/tomcat7
Using JRE_HOME: /usr/local/jdk1.6.0_20/jre
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Check if you are able to get to the home page...
http://localhost:8080.. This should bring up tomcat7 Home page..
If you want to stop the server use:
sudo /usr/share/tomcat7/bin/shutdown.sh
Automatic Starting
To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.
sudo gedit /etc/init.d/tomcat7
Now paste in the following:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
case $1 in
start)
sh /usr/share/tomcat7/bin/startup.sh
;;
stop)
sh /usr/share/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/share/tomcat7/bin/shutdown.sh
sh /usr/share/tomcat7/bin/startup.sh
;;
esac
exit 0
You’ll need to make the script executable by running the chmod command:
sudo chmod 755 /etc/init.d/tomcat7
The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.
sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat
No comments:
Post a Comment