Howto-Install Tomcat in Centos /Fedora the Easy way

Question: Howto-Install Tomcat in Centos /Fedora the Easy way?


The installation is easy, you need to install Java and then Tomocat, to do that open terminal and as root type the following commands:

yum -y install java
yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps

– Finally we can launch Tomcat 6:

#/etc/init.d/tomcat6 start

– To connect to Tomcat, just browse to port 8080 (default) on the server, for example:



– Where to find the important config fils and directories ?

/etc/tomcat6 (this is where the main tomcat config files reside)
/var/lib/tomcat6 (this is where you will add and/or change most of your files)

– Change Default port !!?

Find server.xml in /etc/tomcat6 and change port from 8080 to other unused port

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

save the new config and restart tomcat

– Make admin password for Tomcat

Edit /etc/tomcat6/tomcat-users.xml  and add the following

<?xml version='1.0' encoding='utf-8'?><tomcat-users> <!-- <role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> --> <role rolename="manager"/> <role rolename="admin"/> <user username="admin" password="admin" roles="admin,manager"/> </tomcat-users>
Please post any question you have at Thanks
  • src

     Is there a way to install an headless-java on CentOS ?
    I think java package needs X

  • Guest

    Hi src

    Couldn’t you just download and install Sun’s JDK? No compiling, no X11 required. I prefer it to the packaged options.

    chmod +x ~/jdk-6u27-linux-i586.bin
    cd /usr
    sudo mkdir java
    cd java
    sudo ~/jdk-6u27-linux-i586.bin
    export JAVA_HOME=/usr/java/jdk1.6.0_27
    export PATH=$JAVA_HOME/bin:$PATH