Download and extract Tomcat
mv apache-tomcat-7.0.12.tar.gz /usr/share/apache-tomcat-7.0.12.tar.gz
tar -xzf apache-tomcat-7.0.12.tar.gz
Now you have Apache Tomcat on your server. For some unknown and stupid reason this package does not install Tomcat as a service so, while you have it, it doesn’t really work yet.
Configure Tomcat service
vi tomcat (and paste the code below)
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
case $1 in
Set permissions for your new file
chmod 755 tomcat
chown root:root tomcat
Load at startup / start
chkconfig --add tomcat
chkconfig --level 234 tomcat on
service tomcat start
It’s time to see if it works:
This should work now. You should also try http://220.127.116.11:8080 in your browser (after you replace that IP with yours). This might not work because of your firewall so if it doesn’t while lynx localhost:8080 works you should check your iptables configuration.
Now you have Apache Tomcat running on port 8080. If you want this to be a production server (or just want to use some goodies of Apache HTTPD like mod_rewrite) you should connect Tomcat with HTTPD with the Tomcat connector also known as mod_jk.
So, let’s have mod_jk, easier then ever!