Install and configure tomcat
1. install java
sudo yum install java-1.7.0-openjdk
2. install tomcat
sudo yum install tomcat
sudo yum install tomcat-webapps tomcat-admin-webapps
3. configure the tomcat
open tomcat.conf file
sudo vi /etc/tomcat/tomcat.conf
add the below JAVA_OPTS line
JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"
Put the appropriate value of JAVA_HOME
JAVA_HOME="/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/"
4. Change the tomcat's default port from 8080 to 9090 (skip these step if you are not running anything on port 8080)
Note:- default port on which tomcat run is 8080 but we are alresay running apache on that port.
Open file server.xml
sudo vi /etc/tomcat/server.xml
find the below line
<Connector port="8080" protocol="HTTP/1.1"
Change the port from 8080 to 9090
<Connector port="9090" protocol="HTTP/1.1"
restart the tomcat service
sudo service tomcat restart
5. open the tomcat management console
http://serveripaddress:9090
6. Configure Tomcate Web Mangment Interface
open tomcat-users.xml file
sudo vi /opt/tomcat/conf/tomcat-users.xml
add the below line between
<tomcat-users>...</tomcat-users>
(change the username and password accordingly)<user username="initcron" password="password" roles="manager-gui,admin-gui"/>
Restart the tomcat service
sudo service tomcat restart
Note:- now if you click on server setup or other option it you will have to pass the above credential
7. setup sample application
Download sample application
wget https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
move the sample application to CATALINA_HOME/webapps directory (/usr/share/tomcat/webapps)
Note:- you can see CATALINA_HOME variable value in /etc/tomcat/tomcat.conf file
mv sample.war /usr/share/tomcat/webapps
visit sample apllication by http://ip-address:9090/sample