Have you noticed anything different about this blog in the past 24 hours?
I moved it to my newly upgraded Fedora Core 6 workstation yesterday. And I'm happy to report that setting Tomcat up on a Fedora Core 6 is extremely easy. I'll outline the steps I took to set up a functional Tomcat 5 server:
Install FC6 and Apache Web Server
Stick the Fedora Core 6 DVD in and reboot. Then follow the instructions. I took all defaults where I can, including letting it "delete all Linux partitions" and automatically partition the disk. I choose to install "Web Server" and "Development Tools" when offered the chance. This installs the Apache Web Server 2.2.3 on the box.
Install Tomcat
Tomcat 5 is included in Fedora Core 6, but not installed by default. So I have to bring it in from the repository:
[root@gao]# yum install tomcat5 tomcat5-webapps tomcat5-admin-webapps
This installs Tomcat 5.5.17 and a lot of their dependencies onto the system.
Hook up Tomcat 5 with Apache Web Server
Since I don't want my users to have to type ":8080" all the time, I went ahead and hooked up Tomcat 5 to httpd. In the past, this step had been the most confusing. I remember spending days browsing through Tomcat's website trying to figure out which one of the three alternatives offered there is the one that worked. I still have the mod_jk.so that I compiled from CVS source somewhere on by backup CD-ROMS.
In Fedora Core 6, things are quite straightforward because the version of httpd included contains mod_proxy_ajp which allows httpd to talk to Tomcat 5 through the AJP protocol, which Tomcat 5 listens to on port 8009. To make the connection, I edited /etc/httpd/conf.d/proxy_ajp.conf so that it reads (excluding comments):
[root@gao]# cat /etc/httpd/conf.d/proxy_ajp.conf
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyPass /blog ajp://localhost:8009/blog
Turn on the services
To have httpd and Tomcat 5 start automatically upon reboot, I went to the System->Administration->Services menuitem and enabled both the httpd and tomcat5 services.
Now I have a working Tomcat 5 server. It's webapps directory is at /usr/share/tomcat5/webapps.
Install Sun JDK
So far we have been using the default Java package that came with Fedora Core 6, which is a Free Software implementation of Java based on GNU Gcj, GNU Classpath, and the Eclipse compiler. To run the widest set of Java applications and servlets, I need to install the Sun JDK.
The best way of installing Sun JDK on Fedora Core 6 is to follow the JPackage.org method. I wrote an Introduction to JPackage.org 782 days ago. Things haven't changed much since then (except that now Fedora Core includes a bunch of Java packages, which makes my life easier).
To follow the JPackage.org method, I need to make sure that the following packages are installed:
[root@gao]# yum install jpackage-utils rpm-build libXp unixODBC unixODBC-devel
The first two were already installed when I checked. The others are needed by the JDK.
Then I need to download the JDK (Linux self-extracting file) from Sun's website.
Now we are five command lines away from success:
[root@gao]# rpm -ihv http://mirrors.dotsrc.org/jpackage/5.0/generic/\
non-free/SRPMS/java-1.5.0-sun-1.5.0.10-2jpp.nosrc.rpm
[root@gao]# cp jdk-1_5_0_10-linux-i586.bin /usr/src/redhat/SOURCES
[root@gao]# rpmbuild -ba /usr/src/redhat/SPECS/java-1.5.0-sun.spec
[root@gao]# cd /usr/src/redhat/RPMS/i586
[root@gao]# for x in java-1.5.0-sun-*.rpm; do rpm -ihv $x; done
Read: Tomcat 5 on Fedora Core 6: In Five Easy Steps