[CentOS] Tomcat 4 on Centos 4.1

Todd Reed treed at astate.edu
Mon Oct 17 13:53:42 UTC 2005


I use OpenNMS and this is how I install it.  So far it's worked every time
(6 installs).  Make sure you open up your IPTables as needed.  Let me know
how it goes.
--Todd

--------------
Installing DAG RPM Repository
nano -w /etc/yum.repos.d/dag.repo

[dag]
name=Dag RPM Repository for RHEL
baseURL=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
yum -y update
--------------
Installing Java and Tomcat
Download SDK and JRE from Sun Microsystems to Local Machine
mkdir /usr/local/java
cp /downloads/j2sdk-1_4_2_09-linux-i586.bin /usr/local/java
cp /downloads/j2re-1_4_2_09-linux-i586.bin /usr/local/java
cd /usr/local/java
chmod +x *
./j2sdk-1_4_2_09-linux-i586.bin
./j2re-1_4_2_09-linux-i586.bin
rm -rf *.bin
chown -R root:root j2sdk1.4.2_09
chown -R root:root j2re1.4.2_09
ln -s j2sdk1.4.2_09 j2sdk
ln -s j2re1.4.2_09 j2jre
nano -w /etc/profile
-----START CUT-----
if ! echo ${PATH} | grep -q /usr/local/java/j2sdk/bin ; then
export PATH=/usr/local/java/j2sdk/bin:${PATH}
fi
if ! echo ${PATH} | grep -q /usr/local/java/j2re/bin ; then
export PATH=/usr/java/local/j2re/bin:${PATH}
fi
export JAVA_HOME=/usr/local/java/j2sdk
export
CLASSPATH=.:/usr/local/java/j2sdk/lib/tools.jar:/usr/local/java/j2re/lib/rt.
jar
-----END CUT-----
exit
su -
java -version
java version "1.4.2_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-b05)
Java HotSpot(TM) Client VM (build 1.4.2_09-b05, mixed mode)
cd /downloads
groupadd -g 220 tomcat
useradd -u 220 -g tomcat -c "Tomcat" -r -d /usr/local/tomcat -s
"/sbin/nologin" tomcat
wget
http://mirrors.isc.org/pub/apache/jakarta/tomcat-4/v4.1.31/bin/jakarta-tomca
t-4.1.31.tar.gz
cp jakarta-tomcat-4.1.31.tar.gz /usr/local
cd /usr/local
tar -zxvf jakarta-tomcat-4.1.31.tar.gz
rm *.gz
chown -R tomcat:tomcat /usr/local/jakarta-tomcat-4.1.31
ln -s jakarta-tomcat-4.1.31 tomcat
nano -w /etc/sysconfig/iptables
Add port 8080
service iptables restart
nano -w /etc/profile
Add: CATALINA_HOME=/usr/local/tomcat
echo $CATALINA_HOME
nano -w /etc/rc.d/init.d/tomcat
ADD CONTENT:
-----START CUT-----
#!/bin/sh
#
# Startup script for the Jakarta Tomcat Java Servlets and JSP server
#
# chkconfig: - 85 15
# description: Jakarta Tomcat Java Servlets and JSP server
# 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/local/java/j2sdk
export
CLASSPATH=.:/usr/local/java/j2sdk/lib/tools.jar:/usr/local/java/j2re/lib/rt.
jar
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_OPTS="-Dbuild.compiler.emacs=true"
export PATH=/usr/local/java/j2sdk/bin:/usr/local/local/j2re/bin:$PATH
[ -f /usr/local/tomcat/bin/startup.sh ] || exit 0
[ -f /usr/local/tomcat/bin/shutdown.sh ] || exit 0
export PATH=$PATH:/usr/bin:/usr/local/bin
# See how we were called.
case "$1" in
start)
# Start daemon.
echo -n "Starting Tomcat: "
/usr/local/tomcat/bin/startup.sh
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat
;;
stop)
# Stop daemons.
echo -n "Shutting down Tomcat: "
/usr/local/tomcat/bin/shutdown.sh
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat
;;
restart)
$0 stop
$0 start
;;
condrestart)
[ -e /var/lock/subsys/tomcat ] && $0 restart
;;
status)
status tomcat
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
-----END CUT----- 
chown root:root /etc/rc.d/init.d/tomcat
chmod 755 /etc/rc.d/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
Go to: http://localhost:8080
Note: It will take about 15 seconds to pull up.
 
--------------
Installing RRDTool
yum install rrdtool
 
--------------
Configuring Postgresql
service postgresql start
chkconfig postgresql on
nano -w /var/lib/pgsql/data/postgresql.conf
add/change: tcpip_socket = true
add/change: shared_buffers = 1024
nano -w /var/lib/pgsql/data/pg_hba.conf
change (remove comment): host all all 127.0.0.1 255.255.255.255 trust
change: local all all trust
service postgresql restart
--------------
Configuring OpenNMS
cd /downloads
wget
http://easynews.dl.sourceforge.net/sourceforge/opennms/opennms-1.2.4-1_cento
s4.i386.rpm
wget
http://easynews.dl.sourceforge.net/sourceforge/opennms/opennms-docs-1.2.4-1_
centos4.i386.rpm
wget
http://easynews.dl.sourceforge.net/sourceforge/opennms/opennms-webapp-1.2.4-
1_centos4.i386.rpm
rpm -i opennms-1.2.4-1_centos4.i386.rpm --nodeps
rpm -i opennms-docs-1.2.4-1_centos4.i386.rpm --nodeps
rpm -i opennms-webapp-1.2.4-1_centos4.i386.rpm --nodeps
cd /opt/OpenNMS/bin
./runjava -s
./install -disU
./install -y -w $CATALINA_HOME/webapps -W $CATALINA_HOME/server/lib
cd /opt/OpenNMS/etc
nano -w discovery-configuration.xml
Change the begin and end IP address to 127.0.0.1
service tomcat restart
/opt/OpenNMS/bin/opennms.sh start
chkconfig opennms on
opennms -v status
Goto: http://localhost:8080/opennms/
login with admin:admin
Change password
 
--------------
Configuring SNMP
yum -y install net-snmp-utils
cd /etc/snmp
mv snmpd.conf snmpd.conf.old
nano -w snmpd.conf
Add: rocommunity <password>
chkconfig snmpd on
service snmpd start
snmpwalk -v 1 -c <password> localhost system





-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf
Of Peter Farrow
Sent: Monday, October 17, 2005 5:05 AM
To: CentOS mailing list
Subject: [CentOS] Tomcat 4 on Centos 4.1

Had anyone managed to install Tomcat 4 on Centos 4.1

I want to run OpenNMS but the dependancy list is tortuous to say the 
least (Tomcat4, J2SDK etc etc etc )...

I have rpms for tomcat that install ok, but then the services give a ton 
of errors about missing files when you start/stop them

Failing this can anyone recommend any free Networm Management System for 
Centos, I only need a simple solution just so
that I can import mibs into it and send it traps!

OpenNMS seemed a good choice as it does everything (although rather too 
heavyweight for what I want), as its taken me and
a few Java experts here more than two days to try and install OpenNMS I 
think its time to move onto something else.

Any advice is most welcome!

Regards

Pete

_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20051017/82fa5654/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3022 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20051017/82fa5654/attachment.bin>


More information about the CentOS mailing list