Changes

Jump to: navigation, search

Using vzpkg and vzyum on x86 64

2,878 bytes added, 13:10, 3 March 2008
no edit summary
This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.
This is intended to work in a host with Centos-4 (tested) or a , Centos-5, Fedora Core 5, Fedora Core distribution (not tested)6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.
Last Revision: 08:10, 3 March 2008 (EST)
* - A x86_64 computer
* - A host with x86_64 Centos-4 distribution (or , Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3, or 2.4 or version (vzrpm is unable to run with python 2.5 - not testedversion).
* - Yum package installed.
== TESTED HOSTS ==
 
* - Centos 4
* - Centos 5
* - Fedora Core 5
* - Fedora Core 6
 
 
== HOSTS PROBABLY WORKING (not tested) ==
 
* - RHEL 4
* - RHEL 5
 
 
== HOSTS NOT WORKING ==
 
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3
* - Fedora 7
* - Fedora 8
* - Or any other system with python 2.5 or above.
== SIDE EFFECTS ==
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.
* You can only use the automatic install IF YOU HAVE <b>YUM </b> AND <b>RPM </b> PACKAGES INSTALLED IN YOUR SYSTEM, and if you want to install a Centos-4 cache template.* This process uses a bash script that automatizes which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.* If something goes wrong, or if you want to understand the way it works to install a diferent cache templatedistribution, it's better to do the manual install, and try to adapt it to your needs.
* Read carefully the [[Quick installation]] page and install the openvz kernel, configure the bootloader, change sysctl.conf, and finally reboot your system the way it is described there.
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.23.tar.gz setx86_64-0.3] and then untar and run the script:
<pre>
tar xzvf setx86_64-0.3.tar.gz./sh setx86_64
</pre>
Press Enter and let some tests are made to know if you can go on with the script installation.If you choose to do all go on with it, the job script will download and patch everything for you.All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.
When it finishes with the message "END INSTALL", you can go on reading this document jumping to the undermentioned <b>[[#STEP_10STEP_11|STEP 1011]]</b>.
<b><u>Note</u></b>
This script will almost work for CentOS-5, however it's not quite right (you will get some errors). You will also need to:
<pre>
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so
</pre>
which will cause it to resolve a dependency using your system wide python implementation
=== B - MANUAL INSTALL -STEP BY STEP ===
</code>
We can't "yum install vzyum" because it breaks with an error:<br><b>Error: Missing Dependency: cElementTree.so is needed by package vzyum</b>
So we must download it first and then install it.
wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm
rpm --nodeps -Uvh vzyum*.rpm
yum install vztmpl-centos-4 vzpkg*
</code>
Now let's tweak the code doing it step by step.
You can do a copy-paste from the next command lines to your system.
The example is using <b>Centos-4</b> distribution (tested), but <b>Fedore CoreFedora</b> or other distribution with yum , rpm and rpm python (version 2.2, 2.3 or 2.4) installed, may be tried, if you . You only have to change the reference name and version in STEPS 1 to 4 (this was not tested).
===== STEP 1 =====
If you didn't instal yet Install "vztmpl-centos-4", do it now:
<code>
yum install vztmpl-centos-4
</code>
 
Note: In setx86-0.3 script, all the vztemplates available in openvz.org site are downloaded and used to build x86_64 templates, ready to be used.
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.
We only have to replace i386 references with x86_64 in all files.
<code>
</code>
Now we have a x86_64 centos template installed.<br>You can do the same procedure to other distro templates. 
===== STEP 3 =====
Change the line:
:<code>cachedir=/vz/template/centos/4/x86_64/yum-cache</code>
:to
:<code>cachedir=/var/cache/yum-cache</code>
{{Note| With this changes, vzyum is not going to be able to use a common cache directory to all [[container]]s as it was used to do. Each [[container]] will have it's own cache directory.
To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each [[container]], it is preferable to use the correct cache directory /var/cache/yum-cache.}}
 
===== STEP 4 =====
 
 
Verify the host rpm version:
 
:<code>rpm --version</code>
 
In Centos-4 rpm is version 4.3.
 
Edit this file /vz/template/centos/4/x86_64/config/rpm, and
you will see the number 43.
 
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.<br>
But if we have a different guest template, we might have to correct the values.
 
We have to change the number inside /vz/template/<i>distro</i>/<i>version</i>/x86_64/config/rpm
according to the rpm version of the host system.<br>
If rpm version is 4.4 the number would be 44.<br>
If rpm version is 4.3 the number would be 43.
 
 
 
===== STEP 5 =====
If you list the directory vz-addons like this:
MAKEDEV-3.3.13 (or the version you saw in the "ls")
</pre>
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.
 
===== STEP 5 6 =====
Verify if you have <b>rpm-python</b> installed in your system, because it has 64 bit module needed:
yum install rpm-python
Substitute 32 bit module "In Centos-4 version python is 2.3. So, we must replace rpmmodule.so" from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method:.
<pre>
 
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .
</pre>
For CentOS-5In other Operating Systems or other versions, you will need must verify which python version is installed in the host system. Depending on that, the 32 bit files to do something a bit be replaced are different(read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).    <blockquote style="rpmmodule.sobackground: white; border: 1px solid rgb(153, 153, 153); padding: 1em;" is provided in your sitewide python distribution><b>Note:</b><br>Someone reported the note below, but the tests I made, so instead of copying <u>didn't confirm</u> it was really needed. Everything worked flawless without it across.<br>Nevertheless, if you need tofind some problems, try the workaround described below:<br><br>
<prei>For CentOS-5, you will need to do something a bit different. "rpmmodule.so" is provided in your sitewide python distribution, so instead of copying it across, you need to::rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so</prei></blockquote>
/usr/bin/<b>vzyum</b>
===== STEP 6 7 =====
Edit the file /usr/share/vzpkg/<b>cache-os</b><br>
Change the next lines:
===== STEP 7 8 =====
Edit the file /usr/share/vzpkg/<b>functions</b><br>
Change the next lines:
===== STEP 8 9 =====
Edit the file /usr/bin/<b>vzyum</b><br>
Change the next line:
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].<br>It was impossible to install a package group with spaces in his name.<br>Now we can use e.g. <b>vzyum groupinstall \"GNOME Desktop Environment\"</b>, or other group name listed in vzyum grouplist.<br>(Don't forget the backslash before each doublequote) <b> -Line 56:</b><pre>comment the line 56:#exec $YUM $YUM_ARGS $USER_ARGS</pre> <b> -Last Line (57):</b><br> <pre>add this code: TMPVZY=/tmp/tmpvzy.$$echo $YUM $YUM_ARGS $USER_ARGS > $TMPVZYsh $TMPVZYexec rm -f $TMPVZY</pre>  ===== STEP 9 10 =====
Edit file /usr/bin/<b>vzrpm</b>
Change the next line:
===== STEP 10 11 =====
If you want your [[container]]s to have other country locales
Let's test it!
Make my first two template cachesList all x86_64 templates available:
vzpkgls | grep x86_64
 
 
Choose one of them to create the first cache template (this can be time consuming):
vzpkgcache -f centos-4-x86_64-default
vzpkgcache -f centos-4-x86_64-minimal
They finish It finishes with complaints about <i>cron.daily</i>, but don't worry about it.Now <b>minimal</b> and <b>default</b> cache are is created. Confirm if they are were created: 
vzpkgls -c
If you see it in the cache list, then you can create your first [[container]]: 
vzctl create 200 --ostemplate centos-4-x86_64-minimal
Then test also "vzyum" and see if it works. Try to install "nano editor":
 
vzyum 200 install nano
Try to use vzrpm, to list all rpm's installed in [[container]] 200:
 
vzrpm 200 -qa
If something went wrong, probably you made a mistake in those previous steps.
Carefully verify if you did it well, step by step.
 
12
edits

Navigation menu