Pages

Saturday, November 16, 2013

Apache Tomcat Installtaion


Apache Tomcat Installtaion

http://xmodulo.com/2013/02/how-to-install-apache-tomcat-on-centos.html
/etc/init.d/httpd stop
chkconfig httpd off

###Install Java jdk
yum install java-1.6.0-openjdk-devel -y

####set up JAVA_HOME environment variable.
sh -c 'echo export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk > /etc/profile.d/java.sh'

source /etc/profile.d/java.sh

####Now download Apache Tomcat, and install it
cd /usr
wget http://apache.mirrors.tds.net/tomcat/tomcat-7/v7.0.40/bin/apache-tomcat-7.0.40.tar.gz
tar -zxvf  apache-tomcat-7.0.40.tar.gz

###Then set up a necessary environment variable as follows.
sh -c 'echo export CATALINA_HOME=/usr/apache-tomcat-7.0.40 > /etc/profile.d/tomcat.sh'
source /etc/profile.d/tomcat.sh

###Now start apache tomcat for first time
$CATALINA_HOME/bin/startup.sh

netstat -ntpl | grep java
service iptables stop or allow ports
###### Browse: http://203.190.8.2:8080

To stop and start the servicer tomcat
 $CATALINA_HOME/bin/shutdown.sh
 $CATALINA_HOME/bin/startup.sh


### to use server status, manager apps, host manager username and password

vi /usr/apache-tomcat-7.0.40/conf/tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?>

<tomcat-users>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status"/>
</tomcat-users>


save and restart tomcat by
 $CATALINA_HOME/bin/shutdown.sh
 $CATALINA_HOME/bin/startup.sh


Change 8080 port to 80 port
  vi /usr/apache-tomcat-7.0.40/conf/server.xml
<Connector port="8080"  change to 80  and restart

## Default Page will be in
/usr/apache-tomcat-7.0.40/webapps/ROOT/index.
## If virtual hosts more than one
/usr/apache-tomcat-7.0.40/webapps
mkdir khan
cd khan
vi index.html
now browse: http://203.190.8.2/khan

#### Adding Virtual Host Entries
vi /usr/apache-tomcat-7.0.40/conf/server.xml
<Host name="khan1.com" debug="0" appBase="webapps" unpackWARs="true">
<Alias>m1.daffodinet.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
<Context path="" docBase="/usr/apache-tomcat-7.0.40/webapps/khan" debug="0" reloadable="true"/>
</Host>

<Host name="khan2.com" debug="0" appBase="webapps" unpackWARs="true">
<Alias>m2.daffodilnet.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="virtual_log2." suffix=".log" timestamp="true"/>
<Context path="" docBase="/usr/apache-tomcat-7.0.40/webapps/khan2" debug="0" reloadable="true"/>
</Host>



http://en.youscribe.com/catalogue/manuals-and-practical-information-sheets/knowledge/others/jakarta-tomcat-4-and-5-configuration-and-usage-tutorial-211394
-- 
Tayab Khan

No comments:

Post a Comment