Apache Tomcat is one of the most popular and powerful web application servers on Linux. You can use Tomcat to host Java servlets or JSP web applications. As with any other Apache-licensed software, Tomcat is available free of charge under liberal Apache license. If you would like to install Apache Tomcat on CentOS, here is a guide for you. For Tomcat installation on Debian or Ubuntu. refer to this guide instead.
First, you need to install Java Development Kit (JDK). To do that, set up Repoforge repository on your CentOS system, and then run the following.
Then, set up JAVA_HOME environment variable.
$ source /etc/profile.d/java.sh
Now download Apache Tomcat, and install it. Since Apache Tomcat is distributed as binaries, all you have to do is to copy it somewhere in your CentOS.
$ sudo tar xvzf apache-tomcat-7.0.35.tar.gz -C /opt
$ sudo chmod +r /opt/apache-tomcat-7.0.35/conf/*
Then set up a necessary environment variable as follows.
$ source /etc/profile.d/tomcat.sh
Finally, activate Tomcat by running the following startup script.
Go to http://your_centos_ip:8080 in your browser to test if Apache Tomcat is running okay. If it is, you will see the following in your browser window.
If you cannot access the above Tomcat page, make sure to stop iptables, since CentOS has iptables on by default, and it is set to block the Tomcat's default listening port 8080.
$ sudo chkconfig iptables off
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015