Configure Apache tomcat server on RHEL & CentOS

Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle and provides a “pure Java” HTTP web server environment for running the Java codes.  Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files.


Tomcat server Scenario-

OS-       Centos 6.5
IP-        10.0.2.182/21

Step- 1 

1- Change IP Address..

[root@server ashutosh]# vim /etc/sysconfig/
network-scripts/ifcfg-eth0
------------------------------
---------------------------------
DEVICE="eth0"
IPADDR=10.0.2.182
NETMASK=255.255.248.0
HWADDR="00:16:D4:39:5B:6F"
NM_CONTROLLED="yes"
ONBOOT="yes"
------------------------------
--------------------------------

2- Restart Network Service..


[root@server ashutosh]# service network restart
[root@server ashutosh]# ifconfig


Step-2 Install OpenJDK

[root@pc ~]# yum install java* -y

[root@pc ~]# java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-i386 u55-b13)
OpenJDK Client VM (build 24.51-b03, mixed mode, sharing)

Step-3 Download and Extract Tomcat Archive

[root@pc ~]# cd /tmp

[root@pc tmp]# wget http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz


[root@pc tmp]# tar xzf apache-tomcat-7.0.54.tar.gz

[root@pc tmp]# mv apache-tomcat-7.0.54 /usr/local/tomcat7

[root@pc tmp]# cd /usr/local/tomcat7

[root@pc tomcat7]# ll
 

total 120
drwxr-xr-x. 9 root root  4096  Jun  24 09:23 apache-tomcat-7.0.54
drwxr-xr-x. 2 root root  4096  Jun  24 09:22 bin
drwxr-xr-x. 3 root root  4096  Jun  24 10:00 conf
drwxr-xr-x. 2 root root  4096  Jun  24 09:22 lib
-rw-r--r--.    1 root root 56812  May20 01:05 LICENSE
drwxr-xr-x. 2 root root  4096  Jun  24 09:24 logs
-rw-r--r--.    1 root root  1192  May 20 01:05 NOTICE
-rw-r--r--.    1 root root  8974  May 20 01:05 RELEASE-NOTES
-rw-r--r--.    1 root root 16204 May 20 01:05 RUNNING.txt
drwxr-xr-x. 2 root root  4096  Jun  24 09:22 temp
drwxr-xr-x. 7 root root  4096  May 20 01:03 webapps
drwxr-xr-x. 3 root root  4096  Jun  24 09:24 wo
rk


Step-4 Start Tomcat

[root@pc tomcat7]# ./bin/startup.sh

Using CATALINA_BASE:   /usr/local/tomcat7
Using CATALINA_HOME:   /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat7/bin/
bootstrap.jar:/usr/local/
tomcat7/bin/tomcat-juli.jar
Tomcat started.

Step-5 Access Tomcat in Browser 

http://10.0.2.182:8080/



Step-6 Managing the Apache Tomcat

Tomcat can be managed through the web-manager, the following can be done through that.
Deploy new application, deploy new application on specified context, list the active or in active applications, start and stop the web applications.

Web manager is password protected, requires user name and password to access. Only the user with the “manager-gui” role is allowed to access, these users and roles are defined in tomcat-users.xml. By default “manager-gui” role not defined that file, we need to add it manually.


[root@pc tomcat7]# vi conf/tomcat-users.xml

Place the following two lines just above the last line.

------------------------------
------------------------------
<role rolename=”manager-gui”/>
<user username=”tomcat” password=”tomcat” roles=”manager-gui”/>
------------------------------
------------------------------

Stop and Start the tomcat, now tomcat user have access to the web manager.






Note- If You Want to define other role the click below link-

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Configuring_Manager_Application_Access




I Hope You Like It,
So Enjoy..


______________________________________________________________________________________





Click Back..                                Click Home..


https://docs.google.com/forms/d/1iNRZlJJO6rBFizzPcFmyOTEtfkdjhdVRmpM74IbiT3o/viewform