Check this out:
Installing tomcat 6.0.16:
In the /usr/local directory unzip the tomcat package:
[root@box local]# pwd
/usr/local
[root@box local]# unzip apache-tomcat-6.0.16.zip
.
.
.
inflating: apache-tomcat-6.0.16/webapps/manager/sessionsList.jsp
inflating: apache-tomcat-6.0.16/webapps/manager/status.xsd
inflating: apache-tomcat-6.0.16/webapps/manager/xform.xsl
Go into the apache-tomcat-6.0.16 that got created after unzipping the tomcat package:
[root@box local]# cd apache-tomcat-6.0.16/
[root@box apache-tomcat-6.0.16]# ls -l
total 132
drwxr-xr-x 2 root root 4096 Jan 28 23:39 bin
drwxr-xr-x 2 root root 4096 Jan 28 23:39 conf
drwxr-xr-x 2 root root 4096 Jan 28 23:39 lib
-rw-r--r-- 1 root root 38656 Jan 28 23:39 LICENSE
drwxr-xr-x 2 root root 4096 Jan 28 23:39 logs
-rw-r--r-- 1 root root 572 Jan 28 23:39 NOTICE
-rw-r--r-- 1 root root 7508 Jan 28 23:39 RELEASE-NOTES
-rw-r--r-- 1 root root 6847 Jan 28 23:39 RUNNING.txt
drwxr-xr-x 2 root root 4096 Jan 28 23:39 temp
drwxr-xr-x 7 root root 4096 Jan 28 23:39 webapps
drwxr-xr-x 2 root root 4096 Jan 28 23:39 work
[root@box apache-tomcat-6.0.16]#
Now go into the bin directory:
[root@box apache-tomcat-6.0.16]# cd bin
[root@box bin]# ll
total 672
-rw-r--r-- 1 root root 17530 Jan 28 23:39 bootstrap.jar
-rw-r--r-- 1 root root 9918 Jan 28 23:39 catalina.bat
-rw-r--r-- 1 root root 12785 Jan 28 23:39 catalina.sh
-rw-r--r-- 1 root root 2432 Jan 28 23:39 catalina-tasks.xml
-rw-r--r-- 1 root root 9341 Jan 28 23:39 commons-daemon.jar
-rw-r--r-- 1 root root 1342 Jan 28 23:39 cpappend.bat
-rw-r--r-- 1 root root 2104 Jan 28 23:39 digest.bat
-rw-r--r-- 1 root root 1624 Jan 28 23:39 digest.sh
-rw-r--r-- 1 root root 74398 Jan 28 23:39 jsvc.tar.gz
-rw-r--r-- 1 root root 4947 Jan 28 23:39 service.bat
-rw-r--r-- 1 root root 3307 Jan 28 23:39 setclasspath.bat
-rw-r--r-- 1 root root 4447 Jan 28 23:39 setclasspath.sh
-rw-r--r-- 1 root root 2096 Jan 28 23:39 shutdown.bat
-rw-r--r-- 1 root root 1563 Jan 28 23:39 shutdown.sh
-rw-r--r-- 1 root root 2097 Jan 28 23:39 startup.bat
-rw-r--r-- 1 root root 1956 Jan 28 23:39 startup.sh
-rw-r--r-- 1 root root 57344 Jan 28 23:39 tomcat6.exe
-rw-r--r-- 1 root root 98304 Jan 28 23:39 tomcat6w.exe
-rw-r--r-- 1 root root 18980 Jan 28 23:39 tomcat-juli.jar
-rw-r--r-- 1 root root 187968 Jan 28 23:39 tomcat-native.tar.gz
-rw-r--r-- 1 root root 3189 Jan 28 23:39 tool-wrapper.bat
-rw-r--r-- 1 root root 3291 Jan 28 23:39 tool-wrapper.sh
-rw-r--r-- 1 root root 2101 Jan 28 23:39 version.bat
-rw-r--r-- 1 root root 1567 Jan 28 23:39 version.sh
[root@box bin]#
Make all files whose extension is .sh executable, and verify they are executable by
running the commands chmod +x *.sh and ls –l *.sh respectively:
[root@box bin]# chmod +x *.sh
[root@box bin]# ls -l *sh
-rwxr-xr-x 1 root root 12785 Jan 28 23:39 catalina.sh
-rwxr-xr-x 1 root root 1624 Jan 28 23:39 digest.sh
-rwxr-xr-x 1 root root 4447 Jan 28 23:39 setclasspath.sh
-rwxr-xr-x 1 root root 1563 Jan 28 23:39 shutdown.sh
-rwxr-xr-x 1 root root 1956 Jan 28 23:39 startup.sh
-rwxr-xr-x 1 root root 3291 Jan 28 23:39 tool-wrapper.sh
-rwxr-xr-x 1 root root 1567 Jan 28 23:39 version.sh
[root@box bin]#
Before starting Tomcat, make sure that the box you are installing Tomcat on is not
running another process on TCP port 8080, which is the default Tomcat HTTP server
socket port. Also, check that nothing is running on TCP port 8005, which is the default
Tomcat shutdown server socket port. To check on these, run:
[root@box bin]# netstat -an | grep 8080
[root@box bin]# netstat -an | grep 8005
tcp 0 0 0.0.0.0:8005 0.0.0.0:* LISTEN
[root@box bin]#
If you do not get a response, I like did not get on netstat –an | grep 8080, then it is good.
However, if you get an output like I did on netstat -an | grep 8005, then that means that
another program is listening on port 8005. I need to solve this issue now.
Running:
[root@box bin]# netstat -A inet –lnp
shows that:
tcp 0 0 0.0.0.0:8005 0.0.0.0:* LISTEN 4509/php
a php process is listening on port 8005
Solution:
After talking with the appropriate people responsible for this process, the suggested to
change the tomcat port 8005 to any other port that is free.
After modifying the server.xml file with the new and free port, you are now ready to start
tomcat:
[root@box bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.16
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.16
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.16/temp
Using JRE_HOME: /usr/java/jdk1.6.0_06
[root@box bin]#
To verify it is running, you should get these outputs after running the following
commands:
[root@box bin]# netstat -an | grep 8080
tcp 0 0 :::8080 :::* LISTEN
[root@box bin]# ps auwwx | grep "apache-tomcat*"
root 13336 1.0 2.1 674344 43476 pts/0 Sl 15:31 0:02
/usr/java/jdk1.6.0_06/bin/java -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
Djava.util.logging.config.file=/usr/local/apache-tomcat-
6.0.16/conf/logging.properties -Djava.endorsed.dirs=/usr/local/apache-tomcat-
6.0.16/endorsed -classpath :/usr/local/apache-tomcat-6.0.16/bin/bootstrap.jar -
Dcatalina.base=/usr/local/apache-tomcat-6.0.16 -Dcatalina.home=/usr/local/apachetomcat-
6.0.16 -Djava.io.tmpdir=/usr/local/apache-tomcat-6.0.16/temp
org.apache.catalina.startup.Bootstrap start
root 13373 0.0 0.0 51104 684 pts/0 S+ 15:35 0:00 grep apache-tomcat*
[root@box bin]#
Now point to your browser to see the tomcat page displayed:
http://yourIP:8080
To stop tomcat, run:
[root@box bin]# ./shutdown.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.16
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.16
Using CATALINA_TMPDIR: /usr/local/apache
Using JRE_HOME: /usr/java/jdk1.6.0_06
[root@box bin]#
I hope this helps.
Thanks.
--Willie