How to install Tomcat
Apache Tomcat is a opensource webserver product of Apache Foundation like Apache HTTP server. It is used to 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. In case servers with cPanel or Plesk the installation of Tomcat can be achieved via easyapache and autoinstaller respectively.
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 on web browser by connecting your server on port 8080.
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.
Step 6: Stop tomcat
Finally if you feel that there are no need of Tomcat in your system, You can simply stop it using below command from tomcat home directory.