Installing Tomcat5 on RHEL4 or CentOS4.2 or Centos 5

November 25th, 2007

First, you’ll need some base packages that you may not have already installed.

 
yum install rpm-build gcc-java

If you’re in North America, create a new yum repository file containing lines like the following:

 
[jpackage16-generic]name=JPackage 1.6 Genericbaseurl=
  ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/generic/free/  gpgcheck=1[jpackage16-rhel40]

name=JPackage 1.6 for Red Hat Enterprise Linux 4

baseurl=ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/ \
 redhat-el-4.0/free/gpgcheck=1

If you live outside of North America, please use the closest mirror.

Next, you’ll need to import the Jpackage GPG key:

 
rpm --import http://www.jpackage.org/jpackage.asc

Get some SRPMs for building the non-free packages. I like installing these to /usr/local/src on Linux systems. If you prefer another directory (/tmp works well) use it instead.

 
cd /usr/local/srcwget ftp://jpackage.hmdc.harvard.edu/JPackage/
    1.6/generic/non-free/SRPMS/java-1.4.2-sun-1.4.2.09-1jpp.nosrc.rpm
wget ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/generic/non-free/SRPMS/jta-1.0.1-0.b.4jpp.nosrc.rpm

Download some required files to /usr/src/redhat/SOURCES

  • download jta-1_0_1B-classes.zip here after agreeing to license.
  • download j2sdk-1_4_2_09-linux-i586.bin here after agreeing to license.

This page was last updated on 2005-10-02. You might have to poke around on the to find the right files if Sun has changed those pages too much.

Build and install the non-free packages.

 
rpmbuild --rebuild /usr/local/src/ \
   java-1.4.2-sun-1.4.2.09-1jpp.nosrc.rpmrpm -ivh \
   /usr/src/redhat/RPMS/i586/java-1.4.2-sun-1.4.2.09-1jpp.i586.rpmrpm -ivh /usr/src/redhat/RPMS/i586/ \
  java-1.4.2-sun-devel-1.4.2.09-1jpp.i586.rpmrpmbuild --rebuild --without javadoc /usr/local/src/
  jta-1.0.1-0.b.4jpp.nosrc.rpm \rpm -ivh /usr/src/redhat/RPMS/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm

And finally, install the free packages

 
yum install tomcat5 tomcat5-admin-webapps

“Tim N.” has written to suggest that the above “yum install” line needs to also include “tomcat5-webapps”. I’d imagine it really depends on whether you have dependence on the non-admin webapps or not. However, if you have problems or know you want the non-admin apps, you probably will want to install the “tomcat5-webapps” package as well.

Original Source from : http://www.tummy.com/Community/Articles/tomcat-centos/

Now we create the ’service’ of tomcat5

Create file /etc/init.d/tomcat5

#!/bin/sh
#
# Startup script for jakarta tomcat 5.5.25
#
# chkconfig: - 85 20
# description: Tomcat running
# processname: tomcat
# pidfile: /var/run/tomcat.pid # config:# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0# Set Tomcat environment.
export JAVA_HOME=/usr/lib/java/
export CLASSPATH=.:/usr/java/lib/tools.jar:/usr/lib/java/j2re/lib/rt.jar
export CATALINA_HOME=/usr/lib/tomcat5
export CATALINA_OPTS="-Dbuild.compiler.emacs=true"
export PATH=/usr/lib/java/j2sdk/bin:/usr/lib/j2re/bin:$PATH
[ -f /usr/lib/tomcat5/bin/startup.sh ] || exit 0 [ -f /usr/lib/tomcat5/bin/shutdown.sh ] || exit 0
export PATH=$PATH:/usr/bin:/usr/lib/bin
# See how we were called.
case "$1" in
start)
# Start daemon.
echo -n "Starting Tomcat: "
/usr/lib/tomcat5/bin/startup.sh
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat ;;
stop)
# Stop daemons.
echo -n "Shutting down Tomcat: "
/usr/lib/tomcat5/bin/shutdown.sh
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat ;;
restart)
$0 stop
$0 start
;;
condrestart)
[ -e /var/lock/subsys/tomcat5 ] && $0 restart ;;
status)
status tomcat
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0

And then make this above script executable and add it on chkconfig


# chown root:root /etc/rc.d/init.d/tomcat
# chmod 755 /etc/rc.d/init.d/tomcat
# chkconfig --add tomcat
# chkconfig tomcat on
# service tomcat start

Installing Mapserver in RHEL5

November 2nd, 2007

Building Mapserver 5 on RHEL 5
Slightly modified from this document
http://www.car-chase.net/2007/apr/29/mapserver-newsroom-part-2/

Copied DVD “Server” Directory to /var/www/Server

yum clean all (not really sure what this did, but it was a step)
Install createrepo from above directory - rpm -i createrepo-0.4.4-2.fc6.noarch.rpm
createrepo /var/www/Server
cd /etc/yum.repo.d
copy rhel-debuginfo.repo to something.repo
vi the new file
Example using local file system
[Home Repo]
name=Home Repository
baseurl=file:///var/www/Server/ <– not three slashes
enabled=1 <– change to 1
gpgcheck=0 <– change to 0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Make sure to change “Enabled” to 1 and gpgcheck to “0″

Test
yum install emacs

Now install all of this

yum install \
httpd \
httpd-devel \
byacc \
flex \
php \
php-devel \
python \
python-devel \
gcc-c++ \
curl \
curl-devel \
gd \
gd-devel \
php-gd \
php-dbase

Not going to use PostGIS

First off make the AGG
wget http://www.antigrain.com/agg-2.5.tar.gz
tar zxvf agg-2.5.tar.gz
cd agg-2.5
sh autogen.sh --enable-freetype
./configure
make

Now make proj
wget ftp://ftp.remotesensing.org/proj/proj-4.5.0.tar.gz
tar xzvf proj-4.5.0.tar.gz
cd proj-4.5.0
./configure
make
make install

Using gdal 1.4.2
wget http://www.gdal.org/dl/gdal-1.4.2.tar.gz
tar xzvf gdal-1.4.2.tar.gz
cd gdal-1.4.2
./configure
make
make install

cp /usr/local/lib/libgdal.so.1 /usr/lib

vi /etc/ld.so.conf
add /usr/local/lib
add /usr/lib
Save and ldconfig

Using geos 2.2.3
wget http://geos.refractions.net/geos-2.2.3.tar.bz2
bzunzip2 geos-2.2.3.tar.bz2
tar xvf geos-2.2.3.tar
cd geos-2.2.3
./configure
make
make install

now make Mapserver 5
wget http://download.osgeo.org/mapserver/mapserver-5.0.0.tar.gz
tar xzvf mapserver-5.0.0.tar.gz
cd mapserver-5.0.0.tar.gz
./configure --with-wmsclient --with-wfsclient --with-geos --with-proj --with-gdal --with-ogr --with-httpd=/usr/sbin/httpd --with-php=/var/include/php --with-php=/usr/include/php/ --with-freetype=/usr/bin/freetype-config --with-eppl --with-gd --with-agg=/usr/local/src/agg-2.5

—————————————————————————————————————
//add by who_get@lingkarteknologi.com (CMIIW) who_get@yahoo.com
when error happen about php and php source didnt found in local system, so u must download it
wget http://museum.php.net/php5/php-5.1.6.tar.gz
tar -xzvf php-5.1.6.tar.gz
cd php-5.1.6
./configure

so u back to mapserver-5.0.0 directory and continue to the following step:
./configure --with-wmsclient --with-wfsclient --with-geos --with-proj --with-gdal --with-ogr --with-httpd=/usr/sbin/httpd --with-php=/PATH of PHP-5.1.6/ --with-php=/usr/include/php/ --with-freetype=/usr/bin/freetype-config --with-eppl --with-gd

Oh ya, i have been removing –with-agg because i dont know why my agg cannot load and when i configure mapserver with it this folowing error happen.

configure: error: "could not find agg_rendering_buffer.h" even i have set it to the right path.

any suggestion??

But without agg, configure process has completed and succeed.

So for the first i have starting with this condition.

————————————————————————————

Copy mapserv to your cgi-bin directory
cp mapserv /var/www/cgi_bin/

copy mapscript/php3/php_mapscript.so to /usr/lib/php/modules
cp mapscript/php3/php_mapscript.so to /usr/lib/php/modules

** this module will not work if you SElinux enabled.
To disable or change the mode to disabled or permissive. You can do it several different ways. This was the easiest for me.
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

Save and reboot

After reboot test your mapserv with mapserv -v

[root@www cgi-bin]# ./mapserv -v
MapServer version 5.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT SUPPORTS=GEOS INPUT=EPPL7 INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Now modify the phpinfo.php somewhere
<?
dl("php_mapscript.so");
phpinfo();
?>

And u can see everythings look run well.

NB: Original Document From : http://www.nabble.com/file/p12934222/MP5_RHEL5_AGG.txt