Book
- Custom Ubuntu Desktop
- Custom Ubuntu distribution
- Overview of Lucid based distributon
- Casper (Ubuntu)
- Debian package repository
- GFXboot
- How to create Ubuntu distribution (video lessons)
- How-to about custom ubuntu
- Initrd
- Plymouth
- Remastersys
- SquashFS and InitRamFS and UnionFS
- Ubiquity (Ubuntu)
- Ubuntu Live CD
- Unsorted links about custom Ubuntu
- Usplash
- Custom CentOS distribution
- Flash boot methods
- Ubuntu Development
- Ubuntu Dialup
- Linux How-Tos
- Custom Ubuntu - Issues
Converting RHEL 4 to CentOS 5
1. Converting RHEL 4 to CentOS 4
Here we go:
- First I did the Red Hat package Updating Your System:
up2date --nox -u
You can, if necessary, temporarily "borrow" a license from another server via the rhn.redhat.com web site. Then I rebooted and continued with the final "forced" update:
up2date --nox --update --forced
I would have rebooted a second time if anything had been forcibly updated.
- To expedite the Downloading Required Packages section, I browsed to the correct page for based on the linux version, then copied the link and pasted it into the ssh window prefixed by wget:
wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/centos-release-4-7.i386.rpm wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm wget ftp://mirror.ucsd.edu/centos/4/os/i386/CentOS/RPMS/yum-metadata-parser-1.0-8.el4.centos.i386.rpm
For x86_64 release 4.7 the URLs will be:
wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/centos-release-4-7.x86_64.rpm wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.x86_64.rpm wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.x86_64.rpm wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/sqlite-3.3.6-2.x86_64.rpm wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm wget http://vault.centos.org/4.7/os/x86_64/CentOS/RPMS/yum-metadata-parser-1.0-8.el4.centos.x86_64.rpm
Of course, these URLs will be different for future releases (4.8+, current as of 2008-Dec-07.)
- Removing RHEL Packages
Next, you have to remove some specific packages from Red Hat. As root, run the following commands on your system:
rpm -e --nodeps redhat-release rpm -e rpmdb-redhat service rhnsd stop chkconfig rhnsd off
Note that on the original page, the final command above has been corrected. You can check via:
chkconfg --list rhnsd
- Installing CentOS GPG Key
wget http://mirror.centos.org/centos/RPM-GPG-KEY-centos4 rpm --import RPM-GPG-KEY-centos4
- Installing CentOS Packages
Change into the temporary directory you created for the packages you downloaded above (cd) and run the following as root:
rpm -Uvh *.rpm
You can check to make sure they installed correctly:
rpm -qa | egrep 'yum|splite|centos|python\-'
which also will display additional installed packages.
- Updating With CentOS Package
Once you've upgraded the necessary packages from the set that you downloaded manually, you can let yum take over and finish the job for you. Run the following two command as root: yum clean all yum -y update
The yum -y update may or may not download anything, so do not be alarmed if it doesn't do anything. That simply means your system's packages are up to date with the latest available versions provided by CentOS.
- Reboot to make sure it all works okay.
- Set up yum-cron or yum-update: http://mywiki.ncsa.uiuc.edu/wiki/Server_Installation#Yum_.28Fedora_or_Centos.29
or perhaps as easy as:
service yum start
to start yum-cron
- Delete or comment out root's up2date crontab entry:
crontab -e
2. Converting CentOS 4 to CentOS 5
Although this post is mainly intended for CentOS it should work on RHEL systems as well.
Before you start, A word of advice i believe most experienced RHEL/CentOS users will show you regarding what you’re thinking:
Upgrade between minor versions (i.e. CentOS 5.2 -> 5.3 -> 5.4, or even 5.0 -> 5.4) YES
Upgrade between major system versions (i.e. CentOS 4.8 to CentOS 5.4) NO
As far as I recall, not even Red Hat recommends this – although they do guarantee the miner updates will go smoothly. Even if you manage to hammer that 4.8 to 5.4 upgrade into place, you might end up with a mess that will be very difficult to maintain. Before processing the system update, it’s suggested to create a backup!
If you are currently running a version of RHEL/CentOS earlier than 4.8 (cat /etc/redhat-release), then please do a proper ‘yum update‘ and get your current system updated to 4.8 before we start.
Then the first thing we need to do is to make sure none of our core binaries, libraries or other content is immutable as it causes package installation failures. If you use immutable bits on system paths then you should run these commands:
chattr -Ria /bin chattr -Ria /etc chattr -Ria /etc chattr -Ria /include chattr -Ria /lib chattr -Ria /sbin chattr -Ria /usr/bin chattr -Ria /usr/include chattr -Ria /usr/lib chattr -Ria /usr/libexec chattr -Ria /usr/local/bin chattr -Ria /usr/local/include chattr -Ria /usr/local/lib chattr -Ria /usr/local/sbin chattr -Ria /usr/sbin chattr -Ria /usr/share chattr -Ria /var/lib chattr -Ria /var/lock chattr -Ria /var/log chattr -Ria /var/run chattr -Ria /var/spool/repackage
Once finished, go ahead and have a quick run through of cleaning up yum cache, double check that any pending updates are installed and rebuild the rpmdb:
yum clean all && yum update
If you run into any dependency issues for packages that are not essential, such as syslinux and lftp then you can either exclude them or better just remove them. If the denpency issue is openssh-server related, you can enable telnet login during update by modifing /etc/xinetd.d/telnet.
rpm -e lftp syslinux mkboot
OR (but not recommended)
yum update --exclude=syslinux --exclude=lftp --exclude=mkboot
At this point you should be able to run a ‘yum update‘ command with optional exclude and receive no errors. Now we are ready to get going, please google around, find and download these packages, they mostly available at CentOS official mirror site:
# ls centos-release-5-4.el5.centos.1.i386.rpm python-elementtree-1.2.6-5.el4.centos.i386.rpm centos-release-notes-5.4-4.i386.rpm python-elementtree-1.2.6-5.el5.i386.rpm kernel-2.6.18-164.el5.i686.rpm python-elementtree-1.2.6-5.i386.rpm kernel-devel-2.6.18-164.el5.i686.rpm python-sqlite-1.1.7-1.2.1.i386.rpm
We need to go ahead and setup the centos-release package as follows:
rpm -Uhv centos-release-*.rpm
If you see that CentOS-Base.repo was created as /etc/yum.repos.d/CentOS-Base.repo.rpmnew then move it to the right place:
# mv /etc/yum.repos.d/CentOS-Base.repo.rpmnew /etc/yum.repos.d/CentOS-Base.repo
Now we are ready to go with kernel changes, this is an important part so pay attention. The key to successful upgrade is that you remove ALL OLD KERNELS as many packages will fail to install during the upgrade if they detect a release 4.x kernel due to minimum kernel version dependency checks. We will first start with installing the new CentOS 5.4 kernel so it preserves grub templating:
rpm -ivh kernel-2.6.18-164.el5.i686.rpm kernel-devel-2.6.18-164.el5.i686.rpm --nodeps
NOTE: release 5.x has smp support integrated into the standard kernel, so no *-smp version is required for multi-processor systems.
If you are running an older system the chances are you got allot of older kernel packages installed, so make sure you get them all out of the way:
rpm -e $(rpm -qa | grep kernel | grep -v 2.6.18 | tr 'n' ' ') --nodeps
That said and done you should now only have 2 kernel packages installed which are the 2.6.18 release 5.x kernels. DO NOT under any circumstance continue if you still got 2.6.9 release 4.x kernels packages installed, remove them ALL!
# rpm -qa | grep -i kernel kernel-2.6.18-164.el5 kernel-devel-2.6.18-164.el5
A cleanup of /etc/grub.conf may be required, though the rpm command should have done this for you already, but review it anyways for good measure. You should find that 2.6.18-164.el5 is the only kernel in the file. When kernel updated, a reboot here is OK, but it’s not suggested.
Then we can continute the system updates. There is a known bug with python-elementtree package versions which cause yum/rpm to think the release 4.x version is newer than the 5.x version, to get around this without blowing up the entire python installation we need to remove the package from just the rpmdb as follows:
rpm -e --justdb python-elementtree --nodeps
We can now go ahead and use yum to start the upgrade process, this is a dry run and will take some minutes to compile list of available packages and associated dependency checks. You should carry the exclude options, if any, that you used during the ‘yum update’ process as so to avoid unresolvable dependencies:
yum clean all yum upgrade
You will end up with a small list of dependency errors, these should be resolved by again evaluating a packages need as a critical system component and either removing it with ‘rpm -e‘ or excluding it with ‘–exclude‘ (remember to query description if you are unsure what something does). In my case the packages that threw up red flags were stuff I had manually installed over time such as nfs in addition to default installed samba, these can all safely be removed or excluded as you prefer.
Error: Missing Dependency: perl(Convert::ASN1) is needed by package samba
Error: Missing Dependency: libevent-1.1a.so.1 is needed bypackage nfs-utils
At this point you should be ready to do a final dry run and see where we stand on dependencies, rerun the earlier ‘yum upgrade‘ while making sure to carry over any exclude options you are using.
You should now end up with a summary of actions that yum needs to perform, go ahead and kick it off… this will take a bit time to complete.
Transaction Summary
===========================================================
Install 183 Package(s)
Update 527 Package(s)
Remove 0 Package(s)
Total download size: 679 M
Is this ok [y/N]:Y
Once yum has completed we need to fix a few things, the first is the rpmdb needs a rebuild due to version changes that will cause any rpm commands to fail:
rm -f /var/lib/rpm/__db.00* rpm --rebuilddb yum clean all
The next issue on the list is python-elementtree and python-sqlite, one or both of these may have ended up in a broken state that will cause all yum commands to break, so we will go ahead and reinstall both of them:
rpm -e --justdb python-elementtree --nodeps rpm -ivh python-elementtree-1.2.6-5.el5.i386.rpm rpm -ivh python-sqlite-1.1.7-1.2.1.i386.rpm --nodeps --force
The yum command should now work, go ahead and run it with no options, if you do not get any errors, you are all sorted!
Hopefully the install went well for you, the only thing left to do is go ahead and reboot the system:
shutdown -rf now
For the sake of avoiding a system raised fsck, we will reboot with the -f option to skip fsck.
3. Upgrading kernel modules
3.1. VMware kernel modules
After every Linux kernel update the VMware Workstation kernel modules must be recompiled. With VMware Workstation <= 6.0.5 this was possible with the vmware-config.pl command. In VMware Workstation 6.5 there is the vmware-modconfig-console command but it does not work on RHEL 4 x64:
# /usr/lib/vmware/bin/vmware-modconfig-console --build-mod
Unable to initialize installer database.
As a solution, use attached script:
./recompile-vmware65-modules.sh [KERNELVER]
…
Now restart virtual networking:
/etc/init.d/vmware restart
And restart your virtual machine, eg:
/etc/init.d/winadmin stop /etc/init.d/winadmin start
3.2. Ethernel card drivers
New kernel should have proper ethernet drivers after reboot. See the procedure here.
4. Testing the PS procedure on VmWare
1. Use an existing virtual machine configured with CentOS 5, which has network connection to the PS server. Create three virtual drives in this machine (SCSI is OK at this point), each with a single primary partition and ext3 filesystem:
- 20 Gb for /
- 30 Gb for /group
- 35 Gb for /var/vmware/winadmin
2. rsync disks from RHEL4 to the new disks.
3. Unmount drives from the machine. Shutdown the machine and disconnect the drives.
4. Backup /group and /var/vmware/winadmin disks to a safe place.
5. Create another virtual machine with type "RHEL4 x64" (see attached ps-vm-03.rar), and the following devices:
- fresh 20 Gb IDE drive (RHEL4 kernel cannot mount ext3 from VMWare LSI SCSI) attached to IDE 0:0 (it becomes /dev/hda)
- existing 20 Gb drive with rsync'ed root attached to SCSI 0:1 (it becomes /dev/sda)
- RHEL4 setup ISO image attached to a virtual CD-ROM drive (attached to IDE 1:0, becomes /dev/cdr).
6. Let the machine load from RHEL4 setup CD, start "linux rescue" and let it mount /dev/sda1 as /mnt/sysimage
7. rsync SCSI to IDE:
fdisk /dev/hda <<press "n" to create single ext3 linux partition, "a" to make it active, "w" to write partition table>> mkfs.ext3 /dev/hda1 mkdir /mnt/sysimage/tmp/h mount /dev/hda1 /mnt/sysimage/tmp/h chroot /mnt/sysimage rsync -aSH --exclude /tmp /. /tmp/h mkdir /tmp/h/tm p
Exit from chroot and shutdown the machine.
8. Disconnect the SCSI drive and boot the machine again, with CDROM and IDE drive only.
9. Let the machine load from RHEL4 setup CD, start "linux rescue" and let it mount /dev/hda1 as /mnt/sysimage
10. Edit /mnt/sysimage/etc/fstab (save original version to fstab.orig) and disable all but root mounts. Change root device to /dev/hda1.
11. Edit /mnt/sysimage/boot/grub/grub.conf (save original version to grub.conf.orig) and disable all but single active entry. Change device to "root=/dev/hda1".
12. Install GRUB on the new drive
chroot /mnt/sysimage grub-install --no-floppy --recheck /dev/hda grub-install --no-floppy /dev/hd a
13. Disable Nessus since it fails to load in virtual machine
chkconfig nessusd off
13. Exit from chroot and shutdown the machine. Now disable CDROM connection on startup and boot from virtual hard drive.

Comments
Post new comment