Centos Upgrade 4.x to 5.x
Note: this article is not formatted according to this Wiki standards. Please help reformatting it in a better way. |
To create a CentOS 5 minimal template from centos-4-i386-minimal, follow these steps:
Contents
- 1 Create a container using centos-4-i386-minimal and set a valid nameserver
- 2 Enter container
- 3 Install centos-5-release packages
- 4 Backup your /dev/, since initscripts need udev and will remove vzdev you'll net the backup
- 5 Install initscripts package (forced and with no deps)
- 6 Exit from container
- 7 In /etc/vz/conf/CSID.conf replace
- 8 Copy existing template from
- 9 In /vz/template/centos/4/i386/config/yum.conf change mirrors to CentOS 5
- 10 Upgrade container packages using vzyum (32bit only)
- 11 Stop your VE
- 12 Replace the new /dev/ with the old one
- 13 Leave the container private dir (or it will not start)
- 14 Start the container
- 15 Remove container IP
- 16 Stop container
- 17 Create the template
Create a container using centos-4-i386-minimal and set a valid nameserver
vzctl create $CTID --ostemplate centos-4-i386-minimal --config CONFIG_TEMPLATE --ipadd container_IP --hostname temp vzctl set $CTID --nameserver NAMESERVER_IP --save
Enter container
vzctl enter $CTID
Install centos-5-release packages
rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-notes-5.6-0.i386.rpm \ http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-5-6.el5.centos.i386.rpm
Note: centos-release-5 depends on notes-package, start with that one.
Backup your /dev/, since initscripts need udev and will remove vzdev you'll net the backup
tar -cf dev.tar ./dev
Install initscripts package (forced and with no deps)
rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/initscripts-8.45.33-1.el5.centos.i386.rpm --force --nodeps
Note: If the "transfer failed", go to the CentOS5 mirror and find the latest initscripts rpm and use that instead.
Exit from container
exit
In /etc/vz/conf/CSID.conf replace
OSTEMPLATE="centos-4-i386-minimal"
to
OSTEMPLATE="centos-5-i386-minimal"
Copy existing template from
/vz/template/centos/4
to
/vz/template/centos/5
In /vz/template/centos/4/i386/config/yum.conf change mirrors to CentOS 5
Upgrade container packages using vzyum (32bit only)
vzyum $CTID upgrade
Note: If yum db-version complains do "rm /vz/root/VZNUM/var/lib/rpm/__*" to delete conflicting db.
Stop your VE
vzctl stop $CTID
Replace the new /dev/ with the old one
cd /vz/private/$CTID rm -rf dev tar -xvf dev.tar
Leave the container private dir (or it will not start)
cd
Start the container
vzctl start $CTID
Remove container IP
vzctl set $CTID --ipdel all --save
Stop container
vzctl stop $CTID
Create the template
cd /vz/private/$CTID tar --numeric-owner -zcf /vz/template/cache/centos-5.5-i386-minimal.tar.gz .