Install Sun JDK 1.6 on CentOS

CentOS logo

If you want to create the RPMs by yourself follow all the 3 steps, otherwise you can download the RPMs I created (thisthis and this) and skip the first 2 steps.

 

  1. as root run:
    root:# yum install -y rpm-build gcc gcc-c++ redhat-rpm-config
  2.  
     

  3. as normal user:
    • download from the JPackage archive the latest nosrc.rpm file (at the time of writing it is java-1.6.0-sun-1.6.0.11-1jpp.nosrc.rpm) and place it in your user home directory;
    •  

    • create the RPM building environment by running the two commands below:
      user:$ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
      user:$ echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
    •  

    • download Sun JDK 1.6 update xx from here choosing the same version of the nosrc.rpm file you downloaded in the previous step (don’t get the rpm one) and place it in your ~/rpmbuild/SOURCES directory;
    •  

    • go in your home directory and rebuild the packages by running:
      user:$ rpmbuild --rebuild java-1.6.0-sun-1.6.0.11-1jpp.nosrc.rpm
  4.  
     

  5. as root:
    • go in your user’s ~/rpmbuild/RPMS/i586/ and run the following commands:
      root:# yum --nogpgcheck localinstall -y java-1.6.0-sun-1.6.0.11-1jpp.i586.rpm
      root:# yum --nogpgcheck localinstall -y java-1.6.0-sun-devel-1.6.0.11-1jpp.i586.rpm
      root:# yum --nogpgcheck localinstall -y java-1.6.0-sun-plugin-1.6.0.11-1jpp.i586.rpm
    •  

    • configure the Alternatives system and choose the JDK you want:
      root:# alternatives --config java

One thought on “Install Sun JDK 1.6 on CentOS

Leave a Reply