Sep 12 2005
New Project Installation of Tom Cat 5.5.x with Apache 1.3.x
Apache 1.3.x and Tomcat Tomcat/5.5.9
Installation guide.
Centos 3 operating system with apache and friends install.
how to install Tomcat written on September 12, 2005
by Tepezcuintle.
New Project Installation of Tom Cat 5.5 with Apache 1.3.x
One of our sister companies runs their website using Apache and TomCat.. They use Java
servlet pages and jsp so I was asked to become more familiar with TomCat. I have used tomcat in the past since I had to install in my server once.
The only thing is that has changed since the last time I installed Tomcat is that the new version 5.5 was not available when I installed it on my server a year ago.
Let’s try to make it work on our centos server. As we all remember I wrote a guide on how to install Apache and Friends so with that installation already in place on my server I will continue the installation of Tomcat on my server.
Read the Installation guide on the apache site.
First let’s become familiar with the new options that Tomcat 5.0 offers to us.
Apache Tomcat 5.5.x. Apache Tomcat 5.5 improves on Apache Tomcat 4.1 in many ways, including:
Performance optimizations and reduced garbage collection
Refactored application deployer, with an optional standalone deployer allowing validation and compilation of a web application before putting it in production
Complete server monitoring using JMX and the manager web application
Scalability and reliability enhancements
Improved Taglibs handling, including advanced pooling and tag plugins
Improved platform integration, with native Windows and Unix wrappers
Embedding using JMX
Enhanced Security Manager support
Integrated session clustering
Expanded documentation
So now that I know some of the new features let’s try to download the source for this application.
[mmaldonado@webdogs567 mmaldonado]$ mkdir tomcat
[mmaldonado@webdogs567 mmaldonado]$ cd tomcat/
[mmaldonado@webdogs567 tomcat]$ wget http://www.eng.lsu.edu/mirrors/apache/jakarta/tomcat-5/v5.5.9/bin/jakarta-tomcat-5.5.9.tar.gz
[mmaldonado@webdogs567 jakarta-tomcat-5.5.9]$ tar -zxvf jakarta-tomcat-5.5.9.tar.gz
[mmaldonado@webdogs567 jakarta-tomcat-5.5.9]$ cd jakarta-tomcat-5.5.9
there is a file there RUNNING.txt send that file to yourself to be able to read the instructions. Here is what the instructions say so far.
Installing Java 2 SDK
The first thing you’ll need to do is download the Java 2 SDK for Linux from http://java.sun.com/j2se/downloads.html/. The latest version as of this writing is J2SE 1.4.2 (Java 2 SDK, Standard Edition 1.4.2_03). You can either use a self-extracting file or a RPM (from a self-extracting file). Download the SDK, not the JRE.
The “RPM in self-extracting file” will install Java in /usr/java by default. The “self-extracting file” will install Java in whatever directory you run the file from
[root@webdogs567 tomcat]# mkdir j2sdk
[root@webdogs567 tomcat]# wget http://192.18.97.134/ECom/EComTicketServlet/BEGINE6C5BBD56675C5E8F058A2561B8F2C4A/-2147483648/1048792179/1/636050/635894/1048792179/2ts+/westCoastFSEND/j2sdk-1.4.2_09-oth-JPR/j2sdk-1.4.2_09-oth-JPR:3/j2sdk-1_4_2_09-linux-i586-rpm.bin
–12:20:17– http://192.18.97.134/ECom/EComTicketServlet/BEGINE6C5BBD56675C5E8F058A2561B8F2C4A/-2147483648/1048792179/1/636050/635894/1048792179/2ts+/westCoastFSEND/j2sdk-1.4.2_09-oth-JPR/j2sdk-1.4.2_09-oth-JPR:3/j2sdk-1_4_2_09-linux-i586-rpm.bin
=> `j2sdk-1_4_2_09-linux-i586-rpm.bin’
As you can see wget gives me a file that will have lots of strange characters. this will we fixed once I rename the file. Let’s wait for the download to finish.
here I am renaming the file.
jakarta-tomcat-5.5.9.tar.gz
[root@webdogs567 tomcat]# mv j2sdk-1_4_2_09-linux-i586-rpm.bin\?AuthParam\=1126542136_99808310a0d5078f810b38a278f773a3\&TUrl\=EMr8DPgljlCngjJlNnNDcFaPu0jtT+IO859ZF2EwLi4b1e0IkW%2FTF%2FLVaA\=\=\&TicketId\=dlN3Ow9GOO48+w\=\=\&GroupName\=SDLC\&BHost\=sdlcweb7a.sun.com\&FilePath\=%2FESD15%2FJSCDL%2Fj2 j2sdk-1.rpm.bin
time to run the binary file.
[root@webdogs567 tomcat]# mv j2sdk-1.rpm.bin j2sdk
[root@webdogs567 tomcat]# cd j2sdk/
[root@webdogs567 j2sdk]# ls
j2sdk-1.rpm.bin
[root@webdogs567 j2sdk]# chmod 755 j2sdk-1.rpm.bin then I run the file
[root@webdogs567 j2sdk]# ./j2sdk-1.rpm.bin
after running that command I get the licesing text from Sun.
Do you agree to the above license terms? [yes or no]
say yes.
yes
Unpacking…
Checksumming…
UnZipSFX 5.40 of 28 November 1998, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: j2sdk-1_4_2_09-linux-i586.rpm
Done.
[root@webdogs567 j2sdk]# ls
j2sdk-1_4_2_09-linux-i586.rpm j2sdk-1.rpm.bin
so now I have an rpm of that setup so I am going to install it.
j2sdk-1_4_2_09-linux-i586.rpm j2sdk-1.rpm.bin
[root@webdogs567 j2sdk]# rpm -ivh j2sdk-1_4_2_09-linux-i586.rpm
Preparing… ########################################### [100%]
1:j2sdk ########################################### [100%]
[root@webdogs567 j2sdk]#
so lets continue with our install. :)
just so we know le’s check some RPM setting to see if this was installed properly.
[root@webdogs567 j2sdk]# rpm -qa | grep j2sdk
j2sdk-1.4.2_09-fcs
[root@webdogs567 j2sdk]# rpm -qi j2sdk
Name : j2sdk Relocations: (not relocatable)
Version : 1.4.2_09 Vendor: Sun Microsystems
Release : fcs Build Date: Tue 26 Jul 2005 03:29:26 AM EDT
Install Date: Mon 12 Sep 2005 12:31:52 PM EDT Build Host: localhost.localdomain
Group : Development/Tools Source RPM: j2sdk-1.4.2_09-fcs.src.rpm
Size : 67661393 License: 1994-2001 Sun Microsystems, Inc.
Signature : (none)
Packager : Java Software
URL : http://java.sun.com/linux
Summary : Java(TM) 2 Software Development Kit, Standard Edition
Description :
The Java 2 SDK, Standard Edition includes the Java
Virtual Machine, core class libraries and tools used
by programmers to develop Java software applets and
applications. The SDK also provides the foundation
for IDE (Integrated Development Environment) tools
such as Sun’s Forte for Java, Community Edition,
the Java(TM) 2 Platform, Enterprise Edition (J2EE),
Java-based application servers and more.
The Java 2 Software Development Kit, SDK, is a
development environment for building applications,
applets, and components that can be deployed on
the Java platform. The Java 2 SDK software includes
tools useful for developing and testing programs
written in the Java programming language and running
on the Java platform. These tools are designed to
be used from the command line. Except for
appletviewer, these tools do not provide a
graphical user interface.
[root@webdogs567 j2sdk]#
change into /usr/java and setup a soft link for j2sdk
[root@webdogs567 java]# ln -s j2sdk1.4.2_09/ j2sdk
time to export the path JAVA_HOME
echo export JAVA_HOME=/usr/jave/j2sdk >> /etc/profile
if you check your /etc/profile file you should see that file now has the java path
log out of the shell and then run
echo $JAVA_HOME
[mmaldonado@webdogs567 mmaldonado]$ echo $JAVA_HOME
/usr/java/j2sdk
so the path to java has been setup properly.
#####################################################################
Install ANT. go to /usr/local and run
[root@webdogs567 local]# wget http://apache.oregonstate.edu/ant/binaries/apache-ant-1.6.5-bin.tar.gz
this will download ant on the /usr/local/ directory.
then
[root@webdogs567 local]# tar -zxvf apache-ant-1.6.5-bin.tar.gz
[root@webdogs567 local]# ln -s apache-ant-1.6.5 apache-ant
[root@webdogs567 local]# echo export ANT_HOME=/usr/local/apache-ant >> /etc/profile
[root@webdogs567 local]# exit
exit
[mmaldonado@webdogs567 local]$ su -l root
Password:
[root@webdogs567 root]# echo $ANT_HOME
/usr/local/apache-ant
[root@webdogs567 root]#
so now we have the ANT_HOME variable specified.
#############################################################################
TOMCAT
well now we have to continue since we have to have tomcat in its own directory we will move the existing tomcat folder to /usr/local/
[root@webdogs567 local]# mv jakarta-tomcat-5.5.9.tar.gz /usr/local/
then tar the folder and then make a soft link.
[root@webdogs567 local]# ln -s jakarta-tomcat-5.5.9 jakarta-tomcat
export the CATALINA_HOME folder
[root@webdogs567 local]# echo export CATALINA_HOME=/usr/local/jakarta-tomcat >> /etc/profile
now logout of your shell and relogin so you can test the path
Password:
[root@webdogs567 root]# echo $CATALINA_HOME
/usr/local/jakarta-tomcat
[root@webdogs567 root]#
With that installed we are close to the installation.
Tomcat Account
You will install and configure Tomcat as root; however, you should create a group and user account for Tomcat to run under as follows:
groupadd tomcat
useradd -g tomcat tomcat
now
chown tomcat.tomcat /usr/local/jakarta-tomcat
chown -R tomcat.tomcat /usr/local/jakarta-tomcat-5.5.9
So now it is time to start tomcat. Go into /usr/local/jarkarta-tomcat/bin/startup.sh
the result should be this
/usr/local/jakarta-tomcat/bin
[root@webdogs567 bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/jakarta-tomcat
Using CATALINA_HOME: /usr/local/jakarta-tomcat
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat/temp
Using JRE_HOME: /usr/java/j2sdk
so we have to run nmap and we should see port 8080 open,
but check this out this is the output of nmap.
Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1591 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
25/tcp open smtp
53/tcp open domain
80/tcp open http
111/tcp open sunrpc
113/tcp open auth
631/tcp open ipp
953/tcp open rndc
5432/tcp open postgres
10000/tcp open snet-sensor-mgmt
For some stupid reason this is not working. Let me check something here.
there is a script installed there called version. let me run it.
[root@webdogs567 bin]# ./version.sh
Using CATALINA_BASE: /usr/local/jakarta-tomcat
Using CATALINA_HOME: /usr/local/jakarta-tomcat
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat/temp
Using JRE_HOME: /usr/java/j2sdk
Server version: Apache Tomcat/5.5.9
Server built: Mar 26 2005 02:21:04
Server number: 5.5.9.0
OS Name: Linux
OS Version: 2.4.21-27.0.2.EL
Architecture: i386
JVM Version: 1.4.2_09-b05
JVM Vendor: Sun Microsystems Inc.
So far I see that everything is there as expected. I don’t know why this is not working. The guide seems to be correct and I have followed the instructions online from other people. However further investigation on the RUNNING.TXT files shows the following.
*********** RTMF Read the freaking Manual ***********
Out of the box, Tomcat 5.5 requires the Java 2 Standard Edition Runtime
Environment (JRE) version 5.0 or later. However, you can also run Tomcat
5.5 on earlier versions of the JRE, as detailed below.
What an idiot I should’ve noticed that requirement. I needed to install the new JRE 5.0
from Sun.
so I went to sun and downloaded this.
Linux RPM in self-extracting file jdk-1_5_0_04-linux-i586-rpm.bin
the url is as follows.
http://192.18.97.47/ECom/EComTicketServlet/BEGIN2ABE2C424A5742DEF77F5AFE82F8668D/-2147483648/1049116587/1/627578/627422/1049116587/2ts+/westCoastFSEND/jdk-1.5.0_04-oth-JPR/jdk-1.5.0_04-oth-JPR:4/jdk-1_5_0_04-linux-i586-rpm.bin
renamed the file to jdk-1_5_0_04-linux-i586-rpm.bin
and then ran rpm -ivh jdk-1_5_0_04-linux-i586-rpm.bin
this installed the new version that I needed. Check out my /usr/java folder
[root@webdogs567 java]# ls -all
total 16
drwxr-xr-x 4 root root 4096 Sep 12 15:36 .
drwxr-xr-x 19 root root 4096 Jun 17 15:56 ..
lrwxrwxrwx 1 root root 14 Sep 12 15:36 j2sdk -> j2sdk1.4.2_09/
drwxr-xr-x 8 root root 4096 Sep 12 12:31 j2sdk1.4.2_09
drwxr-xr-x 9 root root 4096 Sep 12 15:26 jdk1.5.0_03
so the existing soft link is pointing to the old version that I had installed earlier.
all i have to do is point the soft link to the right folder.
[root@webdogs567 java]# rm -rf j2sdk
[root@webdogs567 java]# ln -s jdk1.5.0_03/ j2sdk
[root@webdogs567 java]# ls -all
total 16
drwxr-xr-x 4 root root 4096 Sep 12 15:45 .
drwxr-xr-x 19 root root 4096 Jun 17 15:56 ..
lrwxrwxrwx 1 root root 12 Sep 12 15:45 j2sdk -> jdk1.5.0_03/
drwxr-xr-x 8 root root 4096 Sep 12 15:45 j2sdk1.4.2_09
drwxr-xr-x 9 root root 4096 Sep 12 15:26 jdk1.5.0_03
so now it is pointing to the right java . Let’s see if I can start this server.
[root@webdogs567 java]# cd /usr/local/jakarta-tomcat/bin
[root@webdogs567 bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/jakarta-tomcat
Using CATALINA_HOME: /usr/local/jakarta-tomcat
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat/temp
Using JRE_HOME: /usr/java/j2sdk
time to do nmap.
look what I found
8080/tcp open http-proxy
lets run ps -aux
root 17676 8.8 12.2 286352 31148 pts/0 S 15:47 0:09 /usr/java/j2sdk/bin/java -Djava.util.logging.manager=org.apache.juli.Clas
it appears to be running fine. let’s go to the url webdogs567.localdomain:8080
If you’re seeing this page via a web browser, it means you’ve setup Tomcat successfully. Congratulations!
As you may have guessed by now, this is the default Tomcat home page. It can be found on the local filesystem at:
$CATALINA_HOME/webapps/ROOT/index.jsp
This tells me that everything is setup properly :) . The server is running.
Let’s take a break from this and figure other stuff that we need to do on our next guide.
