How to install Apache Tomcat on CentOS 6.3 in few steps

Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. Different versions of Apache Tomcatare available for different versions of the Servlet and JSP specifications. Latest version is Apache Tomcat 7.x. However I will here show and focus on installation of Apache Tomcat 6 on CentOSLinux server. Installation is very easy, basically as long as you have installed Java on system you should be able to quickly install and configure Apache Tomcat 6 on your Linux CentOS 6.3 server in few steps.

  • switch to root
  • install Java
  • verify that Java is installed and present on your machine
su
yum install -y java
java -version

Next steps are involving to install the Apache Tomcat6:

su
yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps
cd /etc/init.d
./tomcat6 start

Once you have installed and started the Apache Tomcat server go to your browser and confirm you have running Tomcat 6 on your server by entering http://localhost:8080  – Apache Tomcat6 uses default port 8080. You can change this latter if you wish.

Here is list and path to important configuration files for Apache Tomcat

/etc/tomcat6 (main tomcat config files reside)
/usr/share/doc/usr/share/tomcat6
/usr/share/tomcat6/bin/usr/share/tomcat6/conf
/usr/share/tomcat6/lib
/usr/share/tomcat6/logs
/usr/share/tomcat6/temp
/usr/share/tomcat6/webapps
/usr/share/tomcat6/work
/var/cache/tomcat6
/var/cache/tomcat6/temp
/var/cache/tomcat6/work
/var/lib/tomcat6 (where you will add and/or change most of your files)
/var/lib/tomcat6/webapps
/var/log/tomcat6

If you wish to change the default port 8080 to different unused port you need to change this part in server.xml

su
gedit /etc/tomcat6/server.xml

scroll down and edit this part in the file:

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>

Once done, save changes and restart the Apache Tomcat and you should be able now access it on new port.

How to create admin password for Apache Tomcat:

  • Edit /etc/tomcat6/tomcat-users.xml 
  • Add the following
 <!--  <role rolename="role1"/>    -->    
<!--      -->

[nggallery id=23]

Leave a Reply