CentOS doesn’t have a package for Sun JDK so it has to installed manually. It’s fairly easy but there are some steps to do that. This guide has been tested on CentOS 5.4 x64_86.
Step 1. Initial setup for building RPM
-!- Do this with a non-root user
- Create ~/.rpmmacros
- 
$ vim ~/.rpmmacros %_topdir /home/ /rpmbuild %_tmppath %{_topdir}/tmp 
 
- 
- Create needed folders:
- 
$ mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}
 
- 
- Build environment needs to be complete. Some needed packages are:
- 
$ sudo yum install -y rpm-build gcc gcc-c++ redhat-rpm-config 
 
- 
Step 2. Installing your favorite JDK
- Download Sun JDK 1.6 update 14 from Sun Java download or the Sun JDK archive.
- Choose the correct platform (for me it’s Linux x64) and download jdk-6u18-linux-x64-rpm.bin
 
- Give it executable rights: $ chmod 755 jdk-6u18-linux-x64-rpm.bin
- Run the binary to extract it into RPM form: $ ./jdk-6u18-linux-x64-rpm.bin
- Install it:
- 
$ sudo rpm -Uvh jdk-6u18-linux-amd64.rpm 
 
- 
- Log out and in again to make the changes in the paths take effect
- Check the install
- 
$ java -version java version "1.6.0_18" Java(TM) SE Runtime Environment (build 1.6.0_18-b07) Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode) 
 
- 
- Java is now installed on /usr/bin/java
Leave a Reply