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.dwget [url]http://www.jpackage.org/jpackage17.repo[/url]

Update your yum repositoriesyum check-update

install JDK 1.5cd /usr/local/srcwget [url]ftp://jpackage.hmdc.harvard.edu/JPackage/1.7/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.13-1jpp.nosrc.rpm[/url]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.rpmrpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-1.5.0-13-1jpp.i586.rpmrpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-devel-1.5.0.13-1jpp.i586.rpmset up environment variablecreate a file /etc/profile.d/jdk.sh which contains this line in it:export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13and 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:[url]http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942[/url]and extract to /usr/local/, rename the directory from Jboss-4.x.x.GAto jbossnow will have jboss files under /usr/local/jboss directorycreate jboss user and groupgroupadd jbossuseradd -d /usr/local/jboss -g jboss jboss

change password for user jbosspasswd jboss

change ownership of the whole directory /usr/local/jboss tojboss:jbosschown jboss:jboss -R /usr/local/jboss

make the jboss control script /etc/init.d/jbosscp /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.0make the file executablechmod +x /etc/init.d/jboss

enable auto start with OS by making symbolic link of /etc/init.d/jboss to system start up level directoryfind 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 5cd /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 startorservice jboss startto stop:/etc/init.d/jboss stoporservice jboss stop

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

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

//////////////////

OLD METHOD

//////////////////

Step 1. Initial setup

Set up ~/.rpmmacros. If you don’t know what this is, just use the example below, replacing <username> by your Linux user name.

 

If you haven’t read http://wiki.centos.org/TipsAndTricks/YumAndRPM yet, remember it is a pre-requisite for using this HowTo.

Remember: the ~/.rpmmacros and the build tree should never be made with the root user.

As an example, it will be assumed that the contents of ~/.rpmmacros is:

%_topdir /home/<username>/rpmbuild%_tmppath %{_topdir}/tmp

Don’t forget to create the rpmbuild tree if it has not been created yet, but be aware that your directory may not be “rpmbuild” like this example (read your ~/.rpmmacros to know):

mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}

Make sure some nedded packages are installed (as root):

yum install -y rpm-build gcc gcc-c++ redhat-rpm-config

Sun JDK 1.6

Tested on: CentOS 4.4 and 5.0.

If you are using CentOS 4, first install the JPackage’s package ‘jpackage-utils’ (version 1.7b). Download the latest jpackage-utils RPM from http://mirrors.dotsrc.org/jpackage/1.7/generic/free/RPMS/ and install:

rpm -Uvh jpackage-utils-1.7.3-1jpp.noarch.rpm

If you’re using CentOS 5, the package ‘jpackage-utils’ is available on the standard repositories:

yum install -y jpackage-utils

Download Sun JDK 1.6 update 1 from http://java.sun.com/javase/downloads/index.jsp. Make sure you download the “RPM in self-extracting file”, and choose the correct architecture (IA64 for Itanium processor or i586 otherwise). The file name is jdk-6u1-linux-i586-rpm.bin. After downloading, make the file executable and run it:

chmod +x jdk-6u1-linux-i586-rpm.bin ./jdk-6u1-linux-i586-rpm.bin

Accept the license agreement, if you want to. Then it will extract the file jdk-6u1-linux-i586.rpm. Download the file http://mirrors.dotsrc.org/jpackage/1.7/generic/non-free/RPMS/java-1.6.0-sun-compat-1.6.0.01-1jpp.i586.rpm. Install both RPMs:

rpm -Uvh jdk-6u1-linux-i586.rpm java-1.6.0-sun-compat-1.6.0.01-1jpp.i586.rpm

Configure the Alternatives system and choose the JDK you want (run as root):

There are 2 programs which provide ‘java’. Selection Command ———————————————– 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java *+ 2 /usr/lib/jvm/jre-1.6.0-sun/bin/java Enter to keep the current selection[+], or type selection number: 2

Then try to execute java:

java -version

You should get:

java version “1.6.0_01″ Java(TM) SE Runtime Environment (build 1.6.0_01-b06) Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

Courtesy: linuxdiyf.com