Last update on .

Java seems to be installed and maintained on Red Hat by using jpackage-utils. JPackage provides a repository of Java packages that can be installed using the package management tool of your choice. At the request of our administrator, here we’ll use the anemic up2date. The jpackage-utils rpm creates the filesystem structure that the jpackage packages depend on.

  1. Remove GCJ RPMS:

    Removing these packages are optional, but it prevents being confused about which Java binaries are being used.

    
    $ sudo rpm -evh java-1.4.2-gcj-compat gcc-java libgcj libgcj-devel
    
  2. Setup up2date to use the jpackage packages:

    Most of the packages are platform independent (it’s Java, after all), so you need to include the “generic” repository. The JPackage examples have a trailing slash, which I removed because yum was adding one too. You don’t need to include the non-free repositories as the nosrc RPMs from there must be downloaded by hand.

    You’ll want to use the mirror closest to you.

    
    $ sudo vim /etc/sysconfig/rhn/sources
    

    Add these lines:

    
    # Repository for Java Packages using jpackage
    yum jpackage16-rhes-4 ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/redhat-el-4.0/ free
    yum jpackage16-generic ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/generic/free
    
  3. Add the jpackage GPG key to RPM:
    
    $ sudo rpm --import http://www.jpackage.org/jpackage.asc
    
  4. Update or install jpackage-utils:
    
    $ sudo up2date -i jpackage-utils
    
  5. Create a directory tree for building RPMS in your home directory:
    
    $ mkdir rpm
    $ mkdir rpm/BUILD
    $ mkdir rpm/RPMS
    $ mkdir rpm/RPMS/i386
    $ mkdir rpm/RPMS/i586
    $ mkdir rpm/RPMS/noarch
    $ mkdir rpm/SOURCES
    $ mkdir rpm/SPECS
    $ mkdir rpm/SRPMS
    $ mkdir rpm/tmp
    
  6. Configure RPM to use the build environment in your home directory:
    
    $ vim ~/.rpmmacros
    
    Add these lines:
    
    %_topdir %(echo ${HOME}/rpm)  
    %_tmppath
    %{_topdir}/tmp
    %packager Your Name 
    # Uncomment to have built RPMs land in RPMS/ instead of RPMS//
    #%_rpmfilename %%{NAME}-%%{VERSION}- %%{RELEASE}.%%{ARCH}.rpm
    

    I forgot the "r" on "packager" and got a cryptic "Package does not exist:" error on an unrelated line. Maybe documenting it here will help some confused person.

  7. Build and install RPMs for Sun's SDK:
    1. Download Sun's JDK 1.5.0 Update 2:

      JDK is the new name for the SDK. Once you agree to the licensing terms, copy the link to download the "Linux self- extracting file" (not the RPM). Paste the link into a wget command to download the file onto your server. The -O flag to wget saves the file with the specified name. This avoids having all the garbage of the URL in the filename.

      
      $ cd rpm/SOURCES/
      $ wget <link to Linux self-extracting file> -O jdk-1_5_0_02-linux-i586.bin
      
    2. Download and install jpackage's java-1.5.0-sun nosrc RPM. When they say that it is the Java Runtime Environment, they really mean JDK:
      
      $ cd
      $ wget ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.02-1jpp.nosrc.rpm
      $ rpm -ivh java-1.5.0-sun-1.5.0.02-1jpp.nosrc.rpm
      
    3. Build the RPMs from the NOSRC RPM:
      
      $ rpmbuild -bb rpm/SPECS/java-1.5.0-sun.spec
      
    4. Install the RPMS:
      
      $ sudo up2date -i unixODBC-devel
      $ sudo rpm -ivh rpm/RPMS/i586/java-1.5.0-sun rpm/RPMS/i586/java-1.5.0-sun- alsa
      $ sudo rpm -ivh rpm/RPMS/i586/java-1.5.0-sun-demo rpm/RPMS/i586/java-1.5.0-sun-devel
      $ sudo rpm -ivh rpm/RPMS/i586/java-1.5.0-sun-fonts rpm/RPMS/i586/java-1.5.0-sun-jdbc
      $ sudo rpm -ivh rpm/RPMS/i586/java-1.5.0-sun-plugin rpm/RPMS/i586/java-1.5.0-sun-src
      
  8. Build and install RPMs for Sun's JTA
    1. Download Sun's JTA Class Files 1.0.1B and the JavaDocs.

      Once you agree to the licensing terms, copy the link to download the zip file. Paste the link into a wget command just like you did for the JDK.

      
      $ cd rpm/SOURCES/
      $ wget <link to JTA classes.zip>
      $ wget <link to JTA JavaDocs.zip>
      
    2. Download and install jpackage's jta-1.0.1-0.b.4jpp NOSRC RPM:
      
      $ cd
      $ wget ftp://jpackage.hmdc.harvard.edu/JPackage/1.6/generic/non-free/SRPMS/jta-1.0.1-0.b.4jpp.nosrc.rpm
      $ rpm -ivh jta-1.0.1-0.b.4jpp.nosrc.rpm
      
    3. Build and install the RPMs:
      
      $ rpmbuild -bb rpm/SPECS/jta.spec
      $ sudo rpm -ivh rpm/RPMS/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm rpm/RPMS/noarch/jta-javadoc-1.0.1-0.b.4jpp.noarch.rpm
      
  9. Install Tomcat and its many dependencies:
    
    $ sudo up2date -i tomcat5
    

These instructions would probably work on CentOS 4 using yum with little modification.

It appears that all of the steps about building RPMS can be skipped by installing Sun's RPM, and then installing the package java-1.5.0-sun-compat. I'm not sure what I would have done about the JTA stuff though.

Pingbacks

Pingbacks are closed.

Comments

Comments are closed.