Returning to - Re: [CentOS] Installing Java 1.4.2

Mon Feb 20 09:13:07 UTC 2006
Will McDonald <wmcdonald at gmail.com>

I had to install the 1.4.2 SDK from Jpackage a while back for some
friend's servers and vaguely documented it as I went. Here's the
relevant bits with the profanities removed :) We'd already rsynced
down the Jpackage repo so where I reference file:// for the baseurl
you'll want to use http/ftp.

PREPARING THE BUILD ENVIRONMENT
Using Jpackage allows us to manage the installation of Java packages
on RPM systems in a consistent fashion. Some packages will still
require downloading of their sources due to licensing restictions but
this source is used, in conjunction with Jpackage supplied SPEC files
to build RPMs.

http://www.jpackage.org/rebuilding.php

First we need to create a build environment as a normal, non-root
user. In this user's home area create the build tree as follows...

 rpm
 |-- BUILD
 |-- RPMS
 |   |-- i386
 |   |-- i586
 |   `-- noarch
 |-- SOURCES
 |-- SPECS
 |-- SRPMS
 `-- tmp

This command will create the build tree shown above...

 $ mkdir -p rpm/{BUILD,RPMS/{i386,i586,noarch},SOURCES,SPECS,SRPMS,tmp}

Create an ~/.rpmmacros file, this will allow you to install SRPMs
locally without b0rking the rest of the system, and add the following
to it, changing the %packager details to your own...

 %_topdir        %(echo ${HOME}/rpm)
 %_tmppath       %{_topdir}/tmp
 %packager       Firstname Lastname < your.address at here>

As the repository files have already been rsync-ed down from the
mirrors onto yumserv1/dev-rhe-a1 now we can setup Setup a Yum
repository definition for the Jpackage repository. In
/etc/yum.repos.d/ create a jpackge.repo and add the following...

 # Be sure to enable the distro specific repository for your distro below:
 # - jpackage-fc for Fedora Core
 # - jpackage-rhel for Red Hat Enterprise Linux and derivatives

 [jpackage-generic]
 name=JPackage (free), generic
 baseurl=ftp://yumserv1/jpackage/1.6/generic/free
 gpgcheck=0
 gpgkey= http://www.jpackage.org/jpackage.asc
 enabled=1

 [jpackage-rhel]
 name=JPackage (free) for Red Hat Enterprise Linux $releasever
 baseurl=ftp://yumserv1/jpackage/1.6/redhat-el-4.0/free/
 gpgcheck=0
 gpgkey=http://www.jpackage.org/jpackage.asc
 enabled=1

 [jpackage-generic-nonfree]
 name=JPackage (non-free), generic
 baseurl= ftp://yumserv1/jpackage/1.6/generic/non-free/
 gpgcheck=0
 gpgkey=http://www.jpackage.org/jpackage.asc
 enabled=1


The firewalls on both yumserv1/dev-rhe-a1 and on webserv1 have been
modified to allow limited FTP for the purposes of Yum updates.

As root install the rpm-build and the Jpackage utils packages...

 # yum -y install rpm-build
 # yum -y install jpackage-utils


INSTALLING JAVA

Grab java-1.4.2-sun-1.4.2.10-1jpp.nosrc.rpm from your Yum repository
and install it as your non-root user...

 $ cd ~/rpm/SRPMS
 $ wget ftp://yumserv1/jpackage/1.6/generic/non-free/SRPMS/java-1.4.2-sun-1.4.2.10-1jpp.nosrc.rpm
 $ rpm -ivh ~/rpm/SRPMS/java-1.4.2-sun-1.4.2.10-1jpp.nosrc.rpm


Get the Java 1.4.2 SDK from http://java.sun.com/j2se/1.4.2/, specifically...

 http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=j2sdk-1.4.2_10-oth-JPR&SiteId=JSC&TransactionId=noreg

This has to be done via a browser because of Sun's click-through
annoyance licensing. Download Linux Platform - Java(TM) 2 SDK,
Standard Edition 1.4.2_10 self-extracting file
j2sdk-1_4_2_10-linux-i586.bin .

Copy this file into ~/rpm/SOURCES and then rpmbuild the RPM from the
SPEC file which was installed when we installed
java-1.4.2-sun-1.4.2.10-1jpp.nosrc.rpm...
 rpmbuild -ba ~/rpm/SPECS/java-1.4.2-sun.spec

This will compile RPMs from the Java SDK and place them in
~/rpm/RPMS/i586. From these RPMs we want to install java-1.4.2-sun,
java-1.4.2-sun-devel and an OS dependancy xorg-x11-deprecated-libs. As
root carry out the following replacing $BUILDUSER with the non-root
username we've been using for the builds...

 # yum -y install
~$BUILDUSER/rpm/RPMS/java-1.4.2-sun-1.4.2.10-1jpp.i586.rpm
~$BUILDUSER/rpm/RPMS/java-1.4.2-sun-devel-1.4.2.10-1jpp.i586.rpm

Yum will take care of the xorg-x11 dependecy for you.