Latest revision |
Your text |
Line 1: |
Line 1: |
− | {{wikify}}
| + | To create a centos 5 minimal template from centos-4-i386-minimal follow the next steps: |
| | | |
− | [[Category:Templates]]
| + | 1 - Create a vps using centos-4-i386-minimal and set a valid nameserver |
− | | |
− | To create a CentOS 5 minimal template from centos-4-i386-minimal,
| |
− | follow these steps:
| |
− | | |
− | ==Create the container==
| |
− | | |
− | Create a container using centos-4-i386-minimal and set a valid nameserver: | |
| <pre> | | <pre> |
− | vzctl create $CTID --ostemplate centos-4-i386-minimal --config CONFIG_TEMPLATE --ipadd container_IP --hostname temp | + | vzctl create VEID --ostemplate centos-4-i386-minimal --config CONFIG_TEMPLATE |
− | vzctl set $CTID --nameserver NAMESERVER_IP --save | + | --ipadd VPS_IP --hostname temp |
| + | vzctl set VEID --nameserver NAMESERVER_IP --save |
| </pre> | | </pre> |
− | | + | 2 - Enter in VPS |
− | | |
− | ==Install centos-5-release packages==
| |
− | Use <code>vzctl exec</code> to execute the rpm install command on the container:
| |
− | | |
| <pre> | | <pre> |
− | vzctl exec $CTID 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.1.i386.rpm | + | vzctl enter VEID |
| </pre> | | </pre> |
− | Note: centos-release-5 depends on notes-package, start with that one.
| + | 3 - Install centos-5-release packages |
− | | |
− | ==Backup dev==
| |
− | | |
− | Backup the container /dev/ directory, as initscripts needs udev and will remove vzdev you'll need the backup:
| |
− | | |
| <pre> | | <pre> |
− | tar -cf $CTID.dev.tar -C /vz/private/$CTID dev
| + | rpm -Uvh http://mirror.centos.org/centos/5.0/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i386.rpm |
| + | rpm -Uvh http://mirror.centos.org/centos/5.0/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm |
| </pre> | | </pre> |
− | | + | 4 - Backup your /dev/, since initscripts need udev and will remove vzdev you'll net the backup |
− | ==Install initscripts package==
| |
− | | |
− | Install initscripts package (forced and with no deps), as per below:
| |
− | | |
| <pre> | | <pre> |
− | vzctl exec $CTID rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/initscripts-8.45.33-1.el5.centos.i386.rpm --force --nodeps
| + | tar -cf dev.tar ./dev |
| </pre> | | </pre> |
− | | + | 5 - Install initscripts package (forced and with no deps) |
− | Note: If the "transfer failed", go to the [http://mirror.centos.org/centos/5/os/i386/CentOS/ CentOS5 mirror] and find the latest initscripts rpm and use that instead.
| |
− | | |
− | ==Update conf file==
| |
− | | |
− | Edit /etc/vz/conf/$CSID.conf and replace
| |
| <pre> | | <pre> |
− | OSTEMPLATE="centos-4-i386-minimal"
| + | 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> |
− | with
| + | 6 - Exit from VPS |
| <pre> | | <pre> |
− | OSTEMPLATE="centos-5-i386-minimal"
| + | exit |
| </pre> | | </pre> |
− | | + | 7 - Upgrade vps packages using vzyum (32bit only) |
− | Alternatively, use the 'sed' command to replace it:
| |
| <pre> | | <pre> |
− | sed -i 's#OSTEMPLATE="centos-4#OSTEMPLATE="centos-5#g' /etc/vz/conf/$CTID.conf
| + | vzyum VEID upgrade |
| </pre> | | </pre> |
− | | + | 8 - Stop your VE |
− | ==Copy existing template==
| |
− | | |
− | Copy existing template from:
| |
− | | |
| <pre> | | <pre> |
− | /vz/template/centos/4
| + | vzctl stop VEID |
| </pre> | | </pre> |
− | to
| + | 9 - Replace the new /dev/ with the old one |
| <pre> | | <pre> |
− | /vz/template/centos/5 | + | cd /vz/private/VEID |
| + | rm -rf dev |
| + | tar -xvf dev.tar |
| </pre> | | </pre> |
− | | + | 10 - Leave the vps private dir (or it will not stard) |
− | ==Update yum.conf==
| |
− | | |
− | In /vz/template/centos/5/i386/config/yum.conf change mirrors to CentOS 5
| |
− | | |
− | Using sed:
| |
− | | |
| <pre> | | <pre> |
− | sed -i 's#centos4#centos5#g' /vz/template/centos/5/i386/config/yum.conf
| + | cd |
− | sed -i 's#CentOS 4#CentOS 5#g' /vz/template/centos/5/i386/config/yum.conf
| |
− | sed -i 's#centos/4/#centos/5/#g' /vz/template/centos/5/i386/config/yum.conf
| |
| </pre> | | </pre> |
− | | + | 11 - Start the VPS |
− | ==Upgrade container packages==
| |
− | | |
− | db-version will complain, so delete the conflicting database first:
| |
| <pre> | | <pre> |
− | rm -fr /vz/root/$CTID/var/lib/rpm/__*
| + | vzctl start VEID |
| </pre> | | </pre> |
− | | + | 12 - Remove VPS IP |
− | Now run vzyum to upgrade the contain packages:
| |
| <pre> | | <pre> |
− | vzyum $CTID upgrade
| + | vzctl set --ipdel VPS_IP |
| </pre> | | </pre> |
− | | + | 13 - Stop VPS |
− | ===Troubleshooting===
| |
− | | |
− | If you get this error:
| |
− | | |
| <pre> | | <pre> |
− | Error: Missing Dependency: python-abi = 2.3 is needed by package python-elementtree
| + | vzctl stop VEID |
| </pre> | | </pre> |
− | | + | 14 - Create the template |
− | and/or
| |
− | <pre>
| |
− | warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
| |
− | Public key for libsepol-1.15.2-3.el5.i386.rpm is not installed
| |
− | </pre>
| |
− | | |
− | You need to run the following before trying again:
| |
− | | |
− | <pre>
| |
− | vzctl exec $CTID rpm -e --justdb python-elementtree --nodeps
| |
− | vzctl exec $CTID rpm --import http://mirrors.kernel.org/centos/RPM-GPG-KEY-CentOS-5
| |
− | </pre>
| |
− | | |
− | ==Test your VE==
| |
− | Check you can enter your VE:
| |
− | <pre>
| |
− | vzctl enter $CTID
| |
− | </pre>
| |
− | | |
− | All went OK? Exit the VE:
| |
− | <pre>
| |
− | exit
| |
− | </pre>
| |
− | | |
− | ===Troubleshooting===
| |
− | | |
− | <pre>
| |
− | Unable to open pty: No such file or directory
| |
− | </pre>
| |
− | If you see errors like this, see the [[VPS_enter_failed]] article.
| |
− | | |
− | ==Stop your VE==
| |
− | <pre>
| |
− | vzctl stop $CTID
| |
− | </pre>
| |
− | | |
− | ==Restore dev==
| |
− | | |
− | This will replace the new /dev/ with the old one:
| |
− | <pre>
| |
− | mv /vz/private/$CTID/dev /vz/private/$CTID/dev.old
| |
− | tar -xvf $CTID.dev.tar -C /vz/private/$CTID
| |
− | </pre>
| |
− | | |
− | == Remove container IP ==
| |
− | <pre>
| |
− | vzctl set $CTID --ipdel all --save
| |
− | </pre>
| |
− | | |
− | ==Create the template==
| |
| <pre> | | <pre> |
− | cd /vz/private/$CTID | + | cd /vz/private/VEID |
− | tar --numeric-owner -zcf /vz/template/cache/centos-5.5-i386-minimal.tar.gz . | + | tar -zcf /vz/template/cache/centos-5.0-i386-minimal.tar.gz . |
| </pre> | | </pre> |