Tuesday, June 29, 2010

Install Apache Tomcat 6.0 in Linux Environment

System: Mint Linux 8.0
Step 1: Download the installation file from http://tomcat.apache.org/tomcat-6.0-doc/index.html
Step 2: Extract the installation file, (if you want to use terminal in linux, here is the command: "tar xvzf apache-tomcat-6.0.14.tar.gz")
Step 3: move to the extracted folder to "/usr/local/tomcat"( Linux Command: sudo mv apache-tomcat-6.0.14 /usr/local/tomcat)
Step 4(optional): If you want the Tomcat server start automatically when your computer boots up, just follow the below instructions:
. go to the directory "/etc/init.d/tomcat' and create the file named "tomcat"
. Copy and paste the following bash script:


# 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/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
Step 5: Link this script to the startup folder by using these command:
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
Step 6: Reboot or logout your computer. If the server doesn't start automatically, open the terminal and execute the command: "sudo service tomcat start"
Note: If you want to stop your server, (trust me, you have to do this if you use Eclipse IDE) use the command in terminal: "sudo service tomcat stop".

After following those steps, you install Apache Tomcat Server successfully.
Good luck

No comments:

Post a Comment