您的位置:首页 > 运维架构 > Linux

How to install Jboss + DB2 on CentOS Linux 4.5 ?

2008-02-20 20:50 573 查看

How to install Jboss + DB2 on CentOS Linux 4.5 ?

I am using Gentoo Linux at home, but I had to install Jboss and DB2 Express-C on CentOS 4.5 at work, here is what you need to do to set them up:

First at all, on CentOS 4.5, I have SELinux disabled and firewall/iptables enabled.

Install JDK 1.5 on CentOS 4.5

In order to use EJB from Jboss, you will need to install JDK 1.5.

CentOS 4.5 comes with Yum (the package management), which makes it much easier to install packages, but there are not so much packages managed in Yum’s default repositories, like Java related packages, so you will need to install an repository for Yum called “jpackage” first.
cd /etc/yum.repos.d
wget http://www.jpackage.org/jpackage17.repo


Update your yum repositories
yum check-update


install JDK 1.5
cd /usr/local/src
wget ftp://jpackage.hmdc.harvard.edu/JPackage/1.7/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.13-1jpp.nosrc.rpm download jdk-1_5_0_13-linux-i586.bin from sun
(under Linux Platform - Java Development Kit 5.0 Update 13 / Linux self-extracting file) and copy to /usr/src/redhat/SOURCES/
rpmbuild –rebuild /usr/local/src/java-1.5.0-sun-1.5.0.13-1jpp.nosrc.rpm
rpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-1.5.0-13-1jpp.i586.rpm
rpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-devel-1.5.0.13-1jpp.i586.rpm


set up environment variable
create a file /etc/profile.d/jdk.sh which contains this line in it:
export J***A_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13
and make it executable:
chmod +x /etc/profile.d/jdk.sh


Install Jboss 4.2.2 GA on CentOS 4.5

download jboss 4.2.2 GA (or the latest version)
download jboss from:
http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942 and extract to /usr/local/, rename the directory from Jboss-4.x.x.GA
to jboss
now will have jboss files under /usr/local/jboss directory

create jboss user and group
groupadd jboss
useradd -d /usr/local/jboss -g jboss jboss


change password for user jboss
passwd jboss


change ownership of the whole directory /usr/local/jboss to
jboss:jboss
chown jboss:jboss -R /usr/local/jboss


make the jboss control script /etc/init.d/jboss
cp /usr/local/jboss/bin/jboss_init_redhat.sh /etc/init.d/jboss

make necessary changes in the file, for example, instead of binding the ip to 127.0.0.1 only, you might want to bind it to external ip, then put this line in the file:
JBOSS_HOST=0.0.0.0
make the file executable
chmod +x /etc/init.d/jboss


enable auto start with OS by making symbolic link of /etc/init.d/jboss to system start up level directory
find out the default start level you are using:
open the file /etc/inittab, look at the beginning of the file, you will see something like this:
id:5:initdefault:
which means your default run level is 5
cd /etc/rc5.d (if your default run level is 3, you will need to change directory to /etc/rc3.d)
ln -s ../init.d/jboss S96jboss


how to start/stop jboss manually ?
to start:
/etc/init.d/jboss start
or
service jboss start
to stop:
/etc/init.d/jboss stop
or
service jboss stop


add exception to firewall
add this line to /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT
restart your firewall:
/etc/init.d/iptables restart


start jboss and type in http://127.0.0.1:8080 in your browser to check if jboss is running

Install DB2 Express-C 9.5 on CentOS 4.5

fix missing /usr/lib/libstdc++.so.5 (db2 was compiled with older c++ library)
yum install compat-libstdc++-33

install required package libaio
yum install libaio

install db2
download DB2 Express-C for Linux zip file from:
http://www-306.ibm.com/software/data/db2/express/download.html unzip
run db2_install and follow the steps

add exceptions on firewall
add these three lines into /etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT -m state –state NEW -p udp -m udp –dport 523 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -p tcp -m tcp –dport 523 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -p tcp -m tcp –dport 50000 -j ACCEPT
restart firewall:
/etc/init.d/iptables restart

create db2 users
groupadd db2grp1
groupadd db2fgrp1
groupadd dasadm1
useradd -g db2grp1 -m -d /opt/ibm/db2/V9.5/db2inst1 db2inst1 -p PASSWORD
useradd -g db2fgrp1 -m -d /opt/ibm/db2/V9.5/db2fenc1 db2fenc1 -p PASSWORD
useradd -g dasadm1 -m -d /opt/ibm/db2/V9.5/dasusr1 dasusr1 -p PASSWORD


create a db2 instance (I chose the
default install path)
cd /opt/ibm/db2/V9.5/instance
./db2icrt -p 50000 -u db2fenc1 db2inst1


create DAS(Administration Server)
cd /opt/ibm/db2/V9.5/instance
./dascrt -u dasadm1


enable db2 auto start with OS
su - db2inst1
db2iauto -on db2inst1


Written by lagjazz on November 14th, 2007 with no comments.
Read more articles on General and Java and Database.

[+] Digg: Feature this article

[+] Del.icio.us: Bookmark this article

[+] Furl: Bookmark this article
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: