Upgrade CentOS 4.x to CentOS 5.x
Note:
Current operating system: CentOS 4.x 64-bit
Purpose:
Use the yum command to upgrade CentOS 4.x to the latest CentOS 5.x version.
1. Upgrade CentOS 4.x to CentOS 4.9
Cd/etc/yum. repos. d/# enter the Directory
Mv CentOS-Base.repo CentOS-Base.repo-bak # Back up previous files
Wget http://vault.centos.org/4.9/centos-base.repo.pdf download the yum source file of centos 4.9
Yum clean all # Clear software packages in the cache directory
Rm-f/var/lib/rpm/_ db * # Delete rpm package data
Rpm -- rebuilddb # rebuilding rpm package data
Yum-y update # upgrade the system
Ii. Upgrade CentOS 4.9 to the latest CentOS 5.x version (currently CentOS 5.10)
Rpm-qa | grep kernel # view the current kernel of the system, as shown below:
######################################## #####
Kernel-smp-2.6.9-89.EL
Kernel-devel-2.6.9-100.EL
Kernel-smp-devel-2.6.9-100.EL
Kernel-2.6.9-100.EL
Kernel-smp-2.6.9-100.EL
Kernel-2.6.9-89.EL
Kernel-devel-2.6.9-89.EL
Kernel-smp-devel-2.6.9-89.EL
Kernel-largesmp-devel-2.6.9-100.EL
Kernel-utils-2.4-23.el4
Kernel-largesmp-devel-2.6.9-89.EL
Rpm-e -- nodeps -- justdb python-elementtree
######################################## #####
# Run the following command to delete the system kernel
Rpm-e -- nodeps -- justdb kernel-smp-2.6.9-89.EL
Rpm-e -- nodeps -- justdb kernel-devel-2.6.9-100.EL
Rpm-e -- nodeps -- justdb kernel-smp-devel-2.6.9-100.EL
Rpm-e -- nodeps -- justdb kernel-2.6.9-100.EL
Rpm-e -- nodeps -- justdb kernel-smp-2.6.9-100.EL
Rpm-e -- nodeps -- justdb kernel-2.6.9-89.EL
Rpm-e -- nodeps -- justdb kernel-devel-2.6.9-89.EL
Rpm-e -- nodeps -- justdb kernel-smp-devel-2.6.9-89.EL
Rpm-e -- nodeps -- justdb kernel-largesmp-devel-2.6.9-100.EL
Rpm-e -- nodeps -- justdb kernel-utils-2.4-23.el4
Rpm-e -- nodeps -- justdb kernel-largesmp-devel-2.6.9-89.EL
Rpm-e -- nodeps -- justdb python-elementtree
Note: The kernel must be deleted. Otherwise, the upgrade may fail. After deletion, run the rpm-qa | grep kernel command to view the kernel again.
System O & M www.osyunwei.com reminder: qihang01 original content©Copyright. For more information, see the source and source text chain.
Cd/etc/yum. repos. d/# enter the Directory
# Download two installation packages for CentOS 5.10
Wget http://mirror.centos.org/centos/5/ OS /x86_64/CentOS/centos-release-5-10.el5.centos.x86_64.rpm
Wget http://mirror.centos.org/centos/5/ OS /x86_64/CentOS/centos-release-notes-5.10-0.x86_64.rpm
# Install a software package
Rpm-Uvh centos-release-notes-5.10-0.x86_64.rpm
Rpm-Uvh centos-release-5-10.el5.centos.x86_64.rpm
# Download the two installation packages of CentOS 5, which will be used later
Wget http://vault.centos.org/5.0/ OS /x86_64/CentOS/python-sqlite-1.1.7-1.2.1.x86_64.rpm
Wget http://vault.centos.org/5.9/ OS /SRPMS/python-sqlite-1.1.7-1.2.1.src.rpm
Cd/etc/yum. repos. d/# enter the Directory
Mv CentOS-Base.repo CentOS-Base.repo-4 # Back up previous files
Download the CentOS-Base.repo for CentOS 5 and upload it to/etc/yum. repos. d/
: Http://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos? Codeblock = 1
Yum clean all # Clear software packages in the cache directory
Rm-f/var/lib/rpm/_ db * # Delete rpm package data
Rpm -- rebuilddb # rebuilding rpm package data
Yum-y remove *. {i386, i586, i686} # Delete the old software package. Important. Otherwise, the system upgrade fails.
Yum-y upgrade # upgrade the system
The following error may occur:
Error 1:
Error: Missing Dependency: python-abi = 2.3 is needed by package python-elementtree
Solution:
# Download the following Software Package
Wget http://vault.centos.org/4.4/ OS /x86_64/CentOS/RPMS/python-elementtree-1.2.6-4.2.1.x86_64.rpm
Rpm-e -- nodeps python-elementtree # Delete the current software package of the system
Rpm-Uvh -- nodeps python-elementtree-1.2.6-4.2.1.x86_64.rpm # install the software package just downloaded
Error 2:
Error: Missing Dependency: libttf. so.2 () (64bit) is needed by package bg5ps
Solution:
Yum-y remove bg5ps # Delete
Yum-y upgrade # continue to upgrade the system
After the upgrade is completed, the complete is displayed!
Iii. yum command repair
After the system is upgraded, the yum command cannot be used. perform the following repair:
Cd/etc/yum. repos. d/# enter the Directory
# Install the downloaded software package
Rpm-Uvh -- nodeps python-sqlite-1.1.7-1.2.1.x86_64.rpm
Rpm-ivh python-sqlite-1.1.7-1.2.1.src.rpm
Cd/usr/src/redhat/SPECS # enter the Directory
Rpmbuild-bb *. spec # create an rpm package
Cd/usr/src/redhat/RPMS/x86_64 # enter the Directory
# Install all packages in this directory
Rpm-Uvh -- force python-sqlite-debuginfo-1.1.7-1.2.1.x86_64.rpm
Rpm-Uvh -- force python-sqlite-1.1.7-1.2.1.x86_64.rpm
Iv. Set system startup parameters
Lsb_release-a # view the system version, as shown in
Rpm-qa | grep kernel # Check the system kernel. If not, run yum install kernel-PAE to install the kernel.
Cat/boot/grub. conf # view system startup settings, as shown in
System O & M www.osyunwei.com reminder: qihang01 original content©Copyright. For more information, see the source and source text chain.
######################################## ##
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.18-371.9.1.el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-371.9.1.el5 ro root = LABEL =/1
Initrd/initrd-2.6.18-371.9.1.el5.img
######################################## ##
We can see that the new system kernel (2.6.18-371.9.1.el5) has been automatically added as the default startup.
Shutdown-r now # restart the system
Uname-a # view the current system kernel
So far, the latest version of CentOS 4.x to CentOS 5.x has been upgraded online.