Difference between revisions of "Centos Upgrade 4.x to 5.x"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
m (I had several problems following this howto on my Centos-5 64-bit host, I added some notes to the problematic sections.)
(vps, ve -> container)
Line 1: Line 1:
To create a centos 5 minimal template from centos-4-i386-minimal follow the next steps:
+
To create a CentOS 5 minimal template from centos-4-i386-minimal,
 +
follow these steps:
  
1 - Create a vps using centos-4-i386-minimal and set a valid nameserver  
+
1 - Create a container using centos-4-i386-minimal and set a valid nameserver  
 
<pre>
 
<pre>
vzctl create VEID --ostemplate centos-4-i386-minimal --config CONFIG_TEMPLATE --ipadd VPS_IP --hostname temp
+
vzctl create CTID --ostemplate centos-4-i386-minimal --config CONFIG_TEMPLATE --ipadd container_IP --hostname temp
vzctl set VEID --nameserver NAMESERVER_IP --save
+
vzctl set CTID --nameserver NAMESERVER_IP --save
 
</pre>
 
</pre>
2 - Enter in VPS
+
2 - Enter in container
 
<pre>
 
<pre>
vzctl enter VEID
+
vzctl enter CTID
 
</pre>
 
</pre>
 
3 - Install centos-5-release packages
 
3 - Install centos-5-release packages
Line 25: Line 26:
 
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
 
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
 
</pre>
 
</pre>
6 - Exit from VPS
+
6 - Exit from container
 
<pre>
 
<pre>
 
exit
 
exit
 
</pre>
 
</pre>
7 - Upgrade vps packages using vzyum (32bit only)
+
7 - Upgrade container packages using vzyum (32bit only)
 
<pre>
 
<pre>
vzyum VEID upgrade
+
vzyum CTID upgrade
 
</pre>
 
</pre>
 
Note: on 64-bit yum db-version might complain. Do "rm /vz/root/VZNUM/var/lib/rpm/__*" to delete conflicting DB.
 
Note: on 64-bit yum db-version might complain. Do "rm /vz/root/VZNUM/var/lib/rpm/__*" to delete conflicting DB.
Line 37: Line 38:
 
8 - Stop your VE
 
8 - Stop your VE
 
<pre>
 
<pre>
vzctl stop VEID
+
vzctl stop CTID
 
</pre>
 
</pre>
 
9 - Replace the new /dev/ with the old one
 
9 - Replace the new /dev/ with the old one
 
<pre>
 
<pre>
cd /vz/private/VEID
+
cd /vz/private/CTID
 
rm -rf dev
 
rm -rf dev
 
tar -xvf dev.tar
 
tar -xvf dev.tar
 
</pre>
 
</pre>
10 - Leave the vps private dir (or it will not stard)
+
10 - Leave the container private dir (or it will not stard)
 
<pre>
 
<pre>
 
cd
 
cd
 
</pre>
 
</pre>
11 - Start the VPS
+
11 - Start the container
 
<pre>
 
<pre>
vzctl start VEID
+
vzctl start CTID
 
</pre>
 
</pre>
12 - Remove VPS IP
+
12 - Remove container IP
 
<pre>
 
<pre>
vzctl set --ipdel VPS_IP
+
vzctl set --ipdel container_IP
 
</pre>
 
</pre>
13 - Stop VPS
+
13 - Stop container
 
<pre>
 
<pre>
vzctl stop VEID
+
vzctl stop CTID
 
</pre>
 
</pre>
 
14 - Create the template
 
14 - Create the template
 
<pre>
 
<pre>
cd /vz/private/VEID
+
cd /vz/private/CTID
 
tar -zcf /vz/template/cache/centos-5.0-i386-minimal.tar.gz .
 
tar -zcf /vz/template/cache/centos-5.0-i386-minimal.tar.gz .
 
</pre>
 
</pre>

Revision as of 11:13, 9 April 2008

To create a CentOS 5 minimal template from centos-4-i386-minimal, follow these steps:

1 - 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

2 - Enter in container

vzctl enter CTID

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 container

exit

7 - Upgrade container packages using vzyum (32bit only)

vzyum CTID 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 CTID

9 - Replace the new /dev/ with the old one

cd /vz/private/CTID
rm -rf dev
tar -xvf dev.tar

10 - Leave the container private dir (or it will not stard)

cd

11 - Start the container

vzctl start CTID

12 - Remove container IP

vzctl set --ipdel container_IP

13 - Stop container

vzctl stop CTID

14 - Create the template

cd /vz/private/CTID
tar -zcf /vz/template/cache/centos-5.0-i386-minimal.tar.gz .