Centos Upgrade 4.x to 5.x
To create a centos 5 minimal template from centos-4-i386-minimal follow the next steps:
1 - Create a vps using centos-4-i386-minimal and set a valid nameserver
vzctl create VEID --ostemplate centos-4-i386-minimal --config CONFIG_TEMPLATE --ipadd VPS_IP --hostname temp vzctl set VEID --nameserver NAMESERVER_IP --save
2 - Enter in VPS
vzctl enter VEID
3 - Install centos-5-release packages
rpm -Uvh http://mirror.centos.org/centos/5.0/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm rpm -Uvh http://mirror.centos.org/centos/5.0/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i386.rpm
Note: centos-release-5 depends on notes-package, start with that one.
4 - Backup your /dev/, since initscripts need udev and will remove vzdev you'll net the backup
tar -cf dev.tar ./dev
5 - Install initscripts package (forced and with no deps)
rpm -Uvh http://mirror.centos.org/centos/5.0/os/i386/CentOS/initscripts-8.45.14.EL-1.el5.centos.1.i386.rpm --force --nodeps
6 - Exit from VPS
exit
7 - Upgrade vps packages using vzyum (32bit only)
vzyum VEID upgrade
Note: on 64-bit yum db-version might complain. Do "rm /vz/root/VZNUM/var/lib/rpm/__*" to delete conflicting DB.
8 - Stop your VE
vzctl stop VEID
9 - Replace the new /dev/ with the old one
cd /vz/private/VEID rm -rf dev tar -xvf dev.tar
10 - Leave the vps private dir (or it will not stard)
cd
11 - Start the VPS
vzctl start VEID
12 - Remove VPS IP
vzctl set --ipdel VPS_IP
13 - Stop VPS
vzctl stop VEID
14 - Create the template
cd /vz/private/VEID tar -zcf /vz/template/cache/centos-5.0-i386-minimal.tar.gz .