Date Created: Sun 15-Mar-2009

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


Installing Tomcat 6.18 on CENTO5

I used the following guide http://de0ris.blogspot.com/2008/08/installing-tomcat-6x-on-centos-5.html and my responses, changed as required are below

Download java JDK 6 Update 12 and Java Runtime Environment (JRE) 6 Update 10 bin (NOT RPM)














2. Open terminal, su to root and move downloaded files to /root directory
$ su root
Password:
# mv [.....]
3. Create java environment
# mkdir /usr/java or similar folder
# cd /usr/java
4. Execute downloaded jdk and jre bins.
Note: might need to change onweship ie chmod 755
# sh /root/jre-6u10-linux-i586.bin
# sh /root/jdk-6u10-linux-i586.bin
5. verify install
# ls
you should see that your /usr/java directory now contains jdk1.6.0_10 and jre1.6.0_10 directories
Install overview

http://ant.apache.org/bindownload.cgi






1. Download and extract Apache Ant (apache-ant-1.7.1-bin.tar.gz) to /usr/share or equivalent

gunzip apache-ant-1.7.1-bin.tar.gz
tar -xvf apache-ant-1.7.1-bin.tar

# cd /usr/share or equivalent
# tar -xzf apache-ant-1.7.1-bin.tar.gz


2. Download and extract Apache Tomcat (apache-tomcat-6.0.18.tar.gz) to /usr/share or equivalent

gunzip apache-tomcat-6.0.18.tar.gz
tar -xvf apache-ant-1.7.1-bin.tar

# tar -xzf apache-tomcat-6.0.18.tar.gz
3. Enable ant link
# ln -s /usr/share/apache-ant-1.7.1/bin/ant /usr/bin

ln -s /var/apache-ant-1.7.1/bin/ant /usr/bin

edit /var/apache-ant-1.7.1/bin/ant to point to: JAVA_HOME=/var/java/jdk1.6.0_12

test ant

ant
Buildfile: build.xml does not exist!
Build failed

4. Set up JAVA_HOME $env in catalina.sh
# cd /usr/share/apache-tomcat-6.0.18/bin

/var/apps/apache-tomcat-6.0.18/bin

# vi catalina.sh
5. After the first line, add following
JAVA_HOME=/usr/java/jdk1.6.0_10

JAVA_HOME=/var/java/jdk1.6.0_12

6. Test config with Tomcat
# cd /usr/share/apache-tomcat-6.0.18/bin

/var/apps/apache-tomcat-6.0.18/bin

# ./startup.sh
7. Check logs for errors
# less /usr/share/apache-tomcat-6.0.18/logs/catalina.out
8. Fix errors if any.


Mar 15, 2009 7:10:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 800 ms
Mar 15, 2009 7:10:46 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 15, 2009 7:10:46 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Mar 15, 2009 7:10:47 PM org.apache.coyote.http11.Http11Protocol start
SEVERE: Error starting endpoint
java.net.BindException: Address already in use<null>:8080
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:502)
at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:519)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:203)
at org.apache.catalina.connector.Connector.start(Connector.java:1131)
at org.apache.catalina.core.StandardService.start(StandardService.java:531)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Mar 15, 2009 7:10:47 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.net.BindException: Address already in use<null>:8080
at org.apache.catalina.connector.Connector.start(Connector.java:1138)
at org.apache.catalina.core.StandardService.start(StandardService.java:531)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Mar 15, 2009 7:10:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 718 ms

=====================

Solution, had another web server running on this 8080, changed the catalina

/var/apps/apache-tomcat-6.0.18/conf


<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->

===================


netstat -an | grep 8090
tcp 0 0 :::8090 :::* LISTEN

==================


Go to http://localhost:8080 for Tomcat's web interface.

Go to http://localhost:8090 for Tomcat's web interface.

401 Unauthorized

You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file will contain the credentials to let you use this webapp.

You will need to add manager role to the config file listed above. For example:
<role rolename="manager"/>
<user username="tomcat" password="s3cret" roles="manager"/>

For more information - please see the Manager App HOW-TO.


==================
Edit tomcat usrs to allow administration

/var/apps/apache-tomcat-6.0.18/conf


http://linux-sxs.org/internet_serving/c516.html

Tomcat Administrator Role admin This is a built-in role.
Tomcat Manager Role manager This is a built-in role.
Tomcat Administrator Username admin  
Tomcat Administrator Password admin  

Launch your favourite editor and add the following lines in green to $CATALINA_HOME/conf/tomcat-users.xml.


From:

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

To:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="admin" password="admin" roles="admin,manager"/>
</tomcat-users>

==================================

Automate start up
1. Create script in /etc/init.d for automated start up/shutdown

# cd /etc/init.d
# vi tomcat

2. Place following in the file
#!/bin/bash
# chkconfig: 234 20 80
# description: Tomcat Server basic start/shutdown script
# processname: tomcat
JAVA_HOME=/usr/java/jdk1.6.0_10
export JAVA_HOME
TOMCAT_HOME=/usr/share/apache-tomcat-6.0.18/bin
START_TOMCAT=/usr/share/apache-tomcat-6.0.18/bin/startup.sh
STOP_TOMCAT=/usr/share/apache-tomcat-6.0.18/bin/shutdown.sh
start() {
echo -n "Starting tomcat: "
cd $TOMCAT_HOME
${START_TOMCAT}
echo "done."
}
stop() {
echo -n "Shutting down tomcat: "
cd $TOMCAT_HOME
${STOP_TOMCAT}
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0

2. Change permissions

# chmod 755 tomcat
3. Add script to system services
# chkconfig --add tomcat
4. Verify modifications (this script uses levels 2-4)
# chkconfig --level 234 tomcat on
# chkconfig --list tomcat
you should see that service using levels 2, 3 and 4:
tomcat 0:off 1:off 2:on 3:on 4:on 5:off 6:off
5. Test script start up/shutdown
# service tomcat start
# service tomcat stop

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories