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

  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- 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-

  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-
      root:# yum --nogpgcheck localinstall -y java-1.6.0-sun-devel-
      root:# yum --nogpgcheck localinstall -y java-1.6.0-sun-plugin-

    • 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

Your email address will not be published. Required fields are marked *