centos 4.0 update

Linux: How to Update and Rebuild CentOS 4 Installation CDs

Question: I found your Fedora Core 2 update page. How can I create new installation CDs for CentOS 4 with the updates already included?

Answer: As with Fedora Core 2, CentOS comes with all of the tools you need to accomplish this. To be consistent, we've provided our procedure broken down into 5 steps below. (This procedure assumes CentOS 4.1 since this is the latest release at the time of writing.)

Since CentOS 4 seems to have the same problem with the DAC960 RAID controller as Fedora Core 2, we've also included a DAC drive fix in our procedure.

Step 1: Preparation

This procedure is not for the novice. If you find this document confusing, it would be best to find an experienced Linux user to help you through it.

To start, a proper build environment is required.

You'll need a computer with CentOS 4 installed on it and 10GB of free hard disk space.

You'll need to be the super user (root) to proceed from here. Commands are assumed to be executed from a bash shell.

The following packages (As well as any packages these require.) will also need to be installed from the installation CD:


Find a location on your hard disk which has the necessary space and type the following commands:

export PYTHONPATH=/usr/lib/anaconda
export PATH="$PATH:/usr/lib/anaconda-runtime"
export BUILDBASE='pwd'
mkdir -p $BUILDBASE/linux/i386/SRPMS
export ARCH=i386

These commands will create a scratchpad area to work from and setup some convenience environment variables.

Next, download all four of the installation ISOs from the CentOS website into the $BUILDBASE/linux directory.

Once the ISO files are downloaded, we will need to extract their contents into our working directory. You can do so with the following commands. (You should place these into a script and execute it.)


for iso in CentOS-4.1-i386-bin1of4.iso CentOS-4.1-i386-bin2of4.iso CentOS-4.1-i386-bin3of4.iso CentOS-4.1-i386-bin4of4.iso; do

   mount -o loop $BUILDBASE/linux/$iso /mnt ; cd /mnt ; \
   tar -cf - * | ( cd $BUILDBASE/linux/i386/ ; tar -xpf - ) ; \
   cd $BUILDBASE ; umount /mnt


If all went well, you can erase the installation ISO files. (You may need the space!)

Step 2: DAC960 Fix

The following steps are required ONLY if you are attempting to fix a booting issue with the DAC960 RAID controller. (The installation CD released by CentOS has a bug which does not allow CentOS 4 to be installed on some computers.)

Proceed to Step 3 if you wish to skip this step.

First, retrieve the latest CentOS 4 kernel source update from a CentOS mirror site. (At the time of writing this web page, it was: kernel-2.6.9-11.EL.src.rpm)

Install the RPM by typing:

rpm -i kernel-2.6.9-11.EL.src.rpm

Go to the /usr/src/redhat/SOURCES directory and modify the following line in the kernel-2.6.9-i586.config file:

# CONFIG_X86_UP_APIC is not set

Change it to:


Next, add the following line below this one and save the file:


Go to the /usr/src/redhat directory and rebuild all of the kernel RPMs by typing:

rpmbuild -ba --target=i586 SPECS/kernel-2.6.spec

This will take a while, but if all goes well, there should be a new set of kernel RPMs in this directory:


Replace the kernel in the $BUILDBASE/linux/i386/CentOS/RPMS directory with the corresponding update from the /usr/src/redhat/RPMS/i586 directory. To do this, type the following command:

cp /usr/src/redhat/RPMS/i586/kernel-2.6.9-11.EL.i586.rpm $BUILDBASE/linux/i586/CentOS/RPMS/.

Step 3: Other updates

If desired at this point, you can download any available updates from a CentOS mirror site and replace each RPM package in the $BUILDBASE/linux/i386/CentOS/RPMS directory with its update.

Step 4: Build

First, we need to re-generate the hdlist file. Do so with the following command:

genhdlist $BUILDBASE/linux/i386

Next, create our package order file by issuing the following command:

pkgorder $BUILDBASE/linux/i386 i386 | tee $BUILDBASE/linux/pkgfile.'date +%Y-%m-%d'

Now, update the installation files by entering the following command:

buildinstall --comp dist-4.1 --pkgorder $BUILDBASE/linux/pkgfile.'date +%Y-%m-%d' \
--version 4.1 --product 'CentOS' --release 'CentOS 4.1' \

Step 5: CD creation

Now that we have completed the build, it's time to split up the files into their CDs and make new ISOs. The following commands will do the split and re-create the hdlist files for each CD:

RELEASE="CentOS 4.1 with updates to $(date '+%Y-%M-%d %H:%m')"

rm -rf $BUILDBASE/linux/i386-disc[1-8]
splittree.py --arch=i386 --total-discs=8 --bin-discs=4 --src-discs=4 --release-string="$RELEASE" \
--pkgorderfile=$BUILDBASE/linux/pkgfile.'date +%Y-%m-%d' \
--distdir=$BUILDBASE/linux/i386 \
--srcdir=$BUILDBASE/linux/i386/SRPMS --productpath=CentOS

rm -f $BUILDBASE/i386-disc1/CentOS/base/hdlist*
genhdlist --withnumbers --fileorder \
$BUILDBASE/fedora/pkgfile.'date +%Y-%m-%d' \

Finally, create a bash script with the commands listed below and execute it. This will create brand new modified ISO images, which you can use to install CentOS Linux!

(You will need to run the following script from the $BUILDBASE/linux directory.)


myname="Joe Blow <joe@joe.blow>"
mkisopts="-R -J -T"
bootopts="-no-emul-boot -boot-load-size 4 -boot-info-table"
mydate="$(date '+%d %b %Y')"
mkisofs $mkisopts $bootopts \
-V "CentOS $distver ($distname) UPDATED Disk 1" \
-A "CentOS $distver ($distname) update created on $mydate" \
-P "$myname" \
-p "$myname" \
-b "$bootimg" \
-c "$bootcat" \
-x lost+found \
-o "$distname"-i386-disc1.iso \

for i in 2 3 4 ; do
mkisofs $mkisopts \
-V "CentOS $distver ($distname) UPDATED Disk $i" \
-A "CentOS $distver ($distname) update created on $mydate" \
-P "$myname" \
-p "$myname" \
-x lost+found \
-o "$distname"-i386-disc${i}.iso \


个人分类: centos
想对作者说点什么? 我来说一句