Apache Tomcat is a opensource webserver product of Apache Foundation like Apache HTTP server. It is used for deploying Java Servlet and JSP applications. To deploy any application in Tomcat, we can simply create a war file and deploy them. This article will help you to install Tomcat 7 on CentOS/RHEL servers.
Step 1: Check Java Version
JAVA is the first requirement for Tomcat 7 installation. Make sure you have JAVA SE 6 or Later version installed in your system. Use following command to check if you have java installed already on your system.
# java -version
In case java is not installed, you will need to install it before proceeding to the tomcat installation.
Step 2: Downloading Tomcat 7 Archive
Download Apache Tomcat archive file from Apache tomcat official download page. You can use below wget command to download it.
# cd /tmp
# wget http://apache.bytenet.in/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz
After competed download extract archive file in /tmp directory and move to proper location as per your need. We are placing this under /usr/local directory.
# tar xzf apache-tomcat-7.0.57.tar.gz
# mv apache-tomcat-7.0.57 /usr/local/tomcat7
Step 3: Starting Tomcat
Tomcat is very easy to use. There is no need to compile its source. You simple extract the archive and start the tomcat server. Tomcat by default start on port 8080. Make sure no other services are running on same port using ‘telnet localhost 8080′.
# cd /usr/local/tomcat7
Step 4: Access Tomcat in Browser
Tomcat server works on port 8080 default. To access Tomcat applications on web browser use port 8080 in the URL.
Step 5: Setup User Accounts
Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside <tomcat-users> </tomcat-users> tags.
If at anytime, you feel that there is no need of Tomcat on your system, you can simply stop it using below command from tomcat home directory.