Building Redhat Enterprise Linux 3 from source

Paul Dwerryhouse

December 7th, 2003


Introduction

In 2003, Red Hat Inc. announced that Redhat 9 was to be their last release of an operating system that would be freely downloadable in a binary form. In its place, they decided to provide backing to the Fedora project to provide a free, community supported Linux distribution, so that Redhat could concentrate all its efforts on its profitable Red Hat Enterprise Linux line.

Red Hat Enterprise Linux is available in a number of editions, WS, ES and AS, which range in price from US$179 to US$18000 per server, depending on the level of support you require and platform that you intend to run it on. The binary packages, however, and not freely available for download. This, of course, presents a problem to those of us who like to try out systems before committing ourselves to them.

Fortunately, the source RPMs to Redhat Enterprise Linux are available, and it is possible to compile up your own Enterprise installation.

http://mirrors.kernel.org/redhat/redhat/linux/enterprise/3/en/

This document details the steps involved in bootstrapping a system from the Redhat Enterprise 3 source RPMs. It's a work in progress, because I haven't actually finished building it yet.


Requirements

The best way of compiling up the RPMs is to do it on an Enterprise system, however, if you already have an installation of this, chances are you won't need to be going through this process. It is possible, however, to compile up most of the RPMs within a Fedora Core 1 environment, with occasional use of Redhat 9 RPMs to plug some gaps along the way, whilst bootstrapping your new system.

You don't need a dedicated Fedora system, however - a chroot environment within another distribution will work, too. I compiled my Enterprise system within Fedora chroot on a Debian machine.


Legal Issues

Rick Moen has an excellent discussion of the legal issues surrounding the distribution of self-compiled RHEL3 distributions here


Where do I start?

The procedure for getting RHEL sources compiled is as follows:


First things first.

Download and install Fedora Core 1, either as a bootable system or as a chroot on your current system. I'm not going to describe this step; if you don't have enough knowledge to be able to do this, then the rest of the document is going to be beyond your capabilities anyway. Install as much of the system as you can, since you're going to need a good number of the tools and libraries.

Create a base directory for your new RHEL system, within your Fedora directory tree. You're going to refer to this directory on the command line quite frequently, so I suggest you keep the path brief. I suggest something like /rhel:

mkdir /rhel

Now initialise the rpm database within this tree:

mkdir -p /rhel/var/lib/rpm
rpm --root=/rhel --initdb

To avoid mixing the RHEL packages with any Fedora packages you might have, we'll build the new packages in your home directory. Do the following to set this up:

echo "$HOME/rpm" > $HOME/.rpmmacros
mkdir $HOME/rpm
cd $HOME/rpm
mkdir BUILD  RPMS  SOURCES  SPECS  SRPMS
cd $HOME/rpm/RPMS
mkdir athlon  i386  i486  i586  i686  noarch

Now, download, compile and install the basesystem SRPM: basesystem-8.0-2.src.rpm

rpmbuild --rebuild basesystem-8.0-2.src.rpm
rpm --root=/rhel -i $HOME/rpm/RPMS/i386/basesystem-8.0-2.noarch.rpm

Similarly, do this with the setup-2.5.27-1.src.rpm and filesystem-2.2.1-3.src.rpm SRPMs:

rpmbuild --rebuild setup-2.5.27-1.src.rpm
rpmbuild --rebuild filesystem-2.2.1-3.src.rpm
rpm --root=/rhel -i setup-2.5.27-1.noarch.rpm
rpm --root=/rhel -i filesystem-2.2.1-3.i386.rpm

Next, compile up and install glibc. The procedure for doing this will be a little different, this time, because the SRPM (glibc-2.3.2-95.3.src.rpm) does not compile properly under Fedora without a slight modification.

Now build and install other important packages, starting with SRPMs such as bash and initscripts. You'll find that these have a large number of dependencies which you will have to build and install first.

There were some packages I couldn't get to compile under Fedora, so I simply fetched the closest matching binary package from either Redhat 9 or Fedora Core 1 and installed those instead. Once we have a basic RHEL installation, we will rebuild everything, so this shouldn't matter.

Binary RPMs from Redhat 9:

cpp-3.2.2-5.i386.rpm
gcc-3.2.2-5.i386.rpm
gcc-gnat-3.2.2-5.i386.rpm
glib-1.2.10-10.i386.rpm
gmp-4.1.2-2.i386.rpm
krb5-libs-1.2.7-10.i386.rpm
libgcj-3.2.2-5.i386.rpm
libgnat-3.2.2-5.i386.rpm
libstdc++-3.2.2-5.i386.rpm
shadow-utils-4.0.3-6.i386.rpm

Binary RPMs from Fedora Core 1:

libgcj-3.3.2-1.i386.rpm
popt-1.8.1-0.30.1.i386.rpm
rpm-4.2.1-0.30.1.i386.rpm
rpm-build-4.2.1-0.30.1.i386.rpm

Once you have all the following packages installed, you should have a system that is capable of building gcc and glibc for itself:

SysVinit-2.85-4
autoconf-2.57-3
automake-1.6.3-5
automake14-1.4p6-6
basesystem-8.0-2
bash-2.05b-29
beecrypt-3.0.1-0.20030630
binutils-2.14.90.0.4-26
bison-1.875-4
byacc-1.9-25
bzip2-1.0.2-11
bzip2-libs-1.0.2-11
chkconfig-1.3.8-3
coreutils-4.5.3-26
cpp-3.2.2-5
cpp-3.2.3-20
cracklib-2.7-22
cracklib-dicts-2.7-22
db4-4.1.25-8
dejagnu-1.4.2-10
dev-3.3.8-1
diffutils-2.8.1-8
e2fsprogs-1.32-15
ed-0.2-33
elfutils-0.89-1
elfutils-libelf-0.89-1
ethtool-1.8-2
expat-1.95.5-6
expect-5.38.0-92
file-3.39-9
filesystem-2.2.1-3
findutils-4.1.7-9
flex-2.5.4a-29
freetype-2.1.4-4.0
freetype-devel-2.1.4-4.0
ftp-0.17-17
gawk-3.1.1-9
gcc-3.2.2-5
gcc-3.2.3-20
gcc-gnat-3.2.2-5
gcc-gnat-3.2.3-20
gd-1.8.4-12
gd-devel-1.8.4-12
gdbm-1.8.0-20
gdbm-devel-1.8.0-20
gettext-0.11.4-7
glib-1.2.10-10
glibc-2.3.2-95.6
glibc-common-2.3.2-95.6
glibc-devel-2.3.2-95.6
glibc-headers-2.3.2-95.6
glibc-kernheaders-2.4-8.34
gmp-4.1.2-2
grep-2.5.1-16
gzip-1.3.3-9
info-4.5-3
initscripts-7.31.6.EL-1
iproute-2.4.7-10
iputils-20020927-11
krb5-libs-1.2.7-10
less-378-11
libacl-2.2.3-1
libacl-devel-2.2.3-1
libattr-2.2.0-1
libattr-devel-2.2.0-1
libgcc-3.2.2-5
libgcc-3.2.3-20
libgcj-3.2.2-5
libgnat-3.2.2-5
libgnat-3.2.3-20
libjpeg-6b-30
libjpeg-devel-6b-30
libpng-1.2.2-16
libpng-devel-1.2.2-16
libstdc++-3.2.2-5
libtermcap-2.0.8-35
libtermcap-devel-2.0.8-35
libtool-1.4.3-6
libtool-libs-1.4.3-6
lsof-4.63-4
m4-1.4.1-13
make-3.79.1-17
mingetty-1.06-1
mktemp-1.5-18
modutils-2.4.25-9.EL
mount-2.11y-31.1
ncurses-5.3-9.3
net-tools-1.60-20
openssl-0.9.7a-22.1
pam-0.75-51
pam-devel-0.75-51
patch-2.5.4-16
pcre-3.9-10
pcre-devel-3.9-10
perl-5.8.0-88.4
perl-Filter-1.29-3
popt-1.8.1-0.30.1
procps-2.0.13-9.2E
psmisc-21.3-1.RHEL.0
python-2.2.3-5
rdist-6.1.5-30
readline-4.3-5
readline-devel-4.3-5
rpm-4.2.1-0.30.1
rpm-build-4.2.1-0.30.1
rsync-2.5.6-20
screen-3.9.15-10
sed-4.0.7-3
setup-2.5.27-1
shadow-utils-4.0.3-6
symlinks-1.2-18
sysklogd-1.4.1-12
tar-1.13.25-13
tcl-8.3.5-92
termcap-11.0.1-17.1
texinfo-4.5-3
time-1.7-23
tzdata-2003c-1
unzip-5.50-34
utempter-0.5.2-16
util-linux-2.11y-31.1
which-2.14-7
words-2-21
zip-2.3-16
zlib-1.1.4-8.1
zlib-devel-1.1.4-8.1

Rebuilding within the chroot

Enter your new RHEL environment by doing the following:

chroot /rhel

At this point, we have to rebuild all the packages again. This is because many of the packages we have built have been linked against the glibc from our parent Fedora installation, which could cause some incompatibilities. For instance, you may see some errors relating to libattr and libacl whenever you run ls within the chroot.

Start off by rebuilding libacl, libattr and then coreutils. Next, rebuild binutils and then gcc, which will take a very long time. Then, do glibc. It may be worth repeating this all again, too.


...to be continued