<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mcarreira</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mcarreira"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Mcarreira"/>
	<updated>2026-05-15T18:56:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=9713</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=9713"/>
		<updated>2011-01-30T18:20:48Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: [[User:Mcarreira|Mcarreira]] 18:07, 30 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has its own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.6.tar.gz setx86_64-0.6] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.6.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{ Note |In setx86_64 script, all the vztemplates available in openvz.org site are downloaded and used to build x86_64 templates, ready to be used.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| &amp;lt;b&amp;gt;1)&amp;lt;/b&amp;gt; With these changes, vzyum won´t be able to use a common cache directory to all [[container]]s as it used to do. Each [[container]] will have its own cache directory.&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2)&amp;lt;/b&amp;gt; To set up a common cache directory, you can use the autofs/automounter daemon together with [[Bind_mounts]] as described in &amp;lt;b&amp;gt;step 12&amp;lt;/b&amp;gt;. Using a shared cache may save a lot of network traffic when installing new VPSs.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64 script, line 334 to line 358, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 97:&amp;lt;/b&amp;gt;&lt;br /&gt;
{{Note| '''ve-vps.basic.conf-sample''' is now renamed '''ve-basic.conf-sample''' }}&lt;br /&gt;
(see [http://bugzilla.openvz.org/show_bug.cgi?id=1694 bug 1694] )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: VECFGSAMPLE=$VECFGDIR/ve-vps.basic.conf-sample&lt;br /&gt;
to: VECFGSAMPLE=$VECFGDIR/ve-basic.conf-sample&lt;br /&gt;
append: if ! [ -f &amp;quot;$VECFGSAMPLE&amp;quot; ]; then VECFGSAMPLE=&amp;quot;$VECGFDIR/ve-vps.basic.conf-sample&amp;quot;; fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/var/lib/yum/ || abort &amp;quot;Can't create /var/lib/yum&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 20:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: VZLIB_SCRIPTDIR=/usr/lib/vzctl/scripts&lt;br /&gt;
to: VZLIB_SCRIPTDIR=/usr/lib64/vzctl/scripts&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 12 =====&lt;br /&gt;
&lt;br /&gt;
To share the vzyum cache directory between various [[containers]], &amp;lt;b&amp;gt;after all is set up&amp;lt;/b&amp;gt;, edit your /etc/auto.master to include the following:&lt;br /&gt;
:&amp;lt;code&amp;gt;/vz/root/{vpsid}/var/cache/yum-cache     /etc/auto.vzyum&amp;lt;/code&amp;gt;&lt;br /&gt;
Include one line for each installed or planned VPS, replacing {vpsid} with the adequate value.&lt;br /&gt;
&lt;br /&gt;
Then, create a /etc/auto.vzyum file with only this line:&lt;br /&gt;
:&amp;lt;code&amp;gt;*     -bind,ro,nosuid,nodev :/var/cache/yum-cache/&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
This file won´t need to be changed, even after you add more containers.&lt;br /&gt;
Restart the automounter daemon.&lt;br /&gt;
&lt;br /&gt;
{{Note| Make sure these changes won´t interfere with other automounts you may already have set up. If you don´t already use autofs/automount, it is safe to comment out other settings in auto.master.}}&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=9712</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=9712"/>
		<updated>2011-01-30T18:07:10Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: [[User:Mcarreira|Mcarreira]] 18:07, 30 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has its own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.6.tar.gz setx86_64-0.6] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.6.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{ Note |In setx86_64 script, all the vztemplates available in openvz.org site are downloaded and used to build x86_64 templates, ready to be used.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| &amp;lt;b&amp;gt;1)&amp;lt;/b&amp;gt; With these changes, vzyum won´t be able to use a common cache directory to all [[container]]s as it used to do. Each [[container]] will have its own cache directory.&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2)&amp;lt;/b&amp;gt; To set up a common cache directory, you can use the autofs/automounter daemon together with [[Bind_mounts]] as described in &amp;lt;b&amp;gt;step 12&amp;lt;/b&amp;gt;. Using a shared cache may save a lot of network traffic when installing new VPSs.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64 script, line 334 to line 358, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 97:&amp;lt;/b&amp;gt;&lt;br /&gt;
{{Note| '''ve-vps.basic.conf-sample''' is now renamed '''ve-basic.conf-sample''' (see bug:[[ http://bugzilla.openvz.org/show_bug.cgi?id=1694 ]]) }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: VECFGSAMPLE=$VECFGDIR/ve-vps.basic.conf-sample&lt;br /&gt;
to: VECFGSAMPLE=$VECFGDIR/ve-basic.conf-sample&lt;br /&gt;
append: if ! [ -f &amp;quot;$VECFGSAMPLE&amp;quot; ]; then VECFGSAMPLE=&amp;quot;$VECGFDIR/ve-vps.basic.conf-sample&amp;quot;; fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/var/lib/yum/ || abort &amp;quot;Can't create /var/lib/yum&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 20:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: VZLIB_SCRIPTDIR=/usr/lib/vzctl/scripts&lt;br /&gt;
to: VZLIB_SCRIPTDIR=/usr/lib64/vzctl/scripts&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 12 =====&lt;br /&gt;
&lt;br /&gt;
To share the vzyum cache directory between various [[containers]], &amp;lt;b&amp;gt;after all is set up&amp;lt;/b&amp;gt;, edit your /etc/auto.master to include the following:&lt;br /&gt;
:&amp;lt;code&amp;gt;/vz/root/{vpsid}/var/cache/yum-cache     /etc/auto.vzyum&amp;lt;/code&amp;gt;&lt;br /&gt;
Include one line for each installed or planned VPS, replacing {vpsid} with the adequate value.&lt;br /&gt;
&lt;br /&gt;
Then, create a /etc/auto.vzyum file with only this line:&lt;br /&gt;
:&amp;lt;code&amp;gt;*     -bind,ro,nosuid,nodev :/var/cache/yum-cache/&amp;amp;&amp;lt;/code&amp;gt;&lt;br /&gt;
This file won´t need to be changed, even after you add more containers.&lt;br /&gt;
Restart the automounter daemon.&lt;br /&gt;
&lt;br /&gt;
{{Note| Make sure these changes won´t interfere with other automounts you may already have set up. If you don´t already use autofs/automount, it is safe to comment out other settings in auto.master.}}&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7114</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7114"/>
		<updated>2009-03-05T11:56:27Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: new script setx86_64-0.5 with fedora-9. Some other corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: 11:55, 5 Mar 2009 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.5.tar.gz setx86_64-0.5] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.5.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{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.&lt;br /&gt;
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.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/var/lib/yum/ || abort &amp;quot;Can't create /var/lib/yum&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 20:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: VZLIB_SCRIPTDIR=/usr/lib/vzctl/scripts&lt;br /&gt;
to: VZLIB_SCRIPTDIR=/usr/lib64/vzctl/scripts&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7112</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7112"/>
		<updated>2009-03-04T15:07:07Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: Corrected LINE 154 of cache-os&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: 17:46, 1 Mar 2009 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.4-1.tar.gz setx86_64-0.4-1] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.4-1.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{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.&lt;br /&gt;
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.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/var/lib/yum/ || abort &amp;quot;Can't create /var/lib/yum&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7100</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7100"/>
		<updated>2009-03-01T17:47:36Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: new setx86_64-0.4-1 version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: 17:46, 1 Mar 2009 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.4-1.tar.gz setx86_64-0.4-1] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.4-1.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{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.&lt;br /&gt;
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.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/proc || abort &amp;quot;Can't create dir $VE_ROOT/proc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7098</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7098"/>
		<updated>2009-02-28T04:01:04Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: 04:10, 28 Feb 2009 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.4.tar.gz setx86_64-0.4] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.4.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{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.&lt;br /&gt;
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.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/proc || abort &amp;quot;Can't create dir $VE_ROOT/proc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7097</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=7097"/>
		<updated>2009-02-28T03:59:51Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: new script setx86_64-0.4. Minor corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: 08:10, 3 March 2008 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.4.tar.gz setx86_64-0.4] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.4.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{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.&lt;br /&gt;
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.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 154:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
append: mkdir -p $VE_ROOT/proc || abort &amp;quot;Can't create dir $VE_ROOT/proc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=4222</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=4222"/>
		<updated>2008-03-03T13:10:52Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a host with Centos-4, Centos-5, Fedora Core 5, Fedora Core 6, RHEL 4 or any other RPM based based system with python 2.2, 2.3 or 2.4 version.&lt;br /&gt;
&lt;br /&gt;
Last Revision: 08:10, 3 March 2008 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each [[container]] using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - A host with x86_64 Centos, Fedora Core or RHEL, or other Redhat based systems with python 2.2, 2.3 or 2.4 version (vzrpm is unable to run with python 2.5 version)&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTED HOSTS ==&lt;br /&gt;
&lt;br /&gt;
* - Centos 4&lt;br /&gt;
* - Centos 5&lt;br /&gt;
* - Fedora Core 5&lt;br /&gt;
* - Fedora Core 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS PROBABLY WORKING (not tested) ==&lt;br /&gt;
&lt;br /&gt;
* - RHEL 4&lt;br /&gt;
* - RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HOSTS NOT WORKING ==&lt;br /&gt;
&lt;br /&gt;
* - Older distros with yum version less then 2.4, python version less then 2.2, rpm version less then 4.3&lt;br /&gt;
* - Fedora 7&lt;br /&gt;
* - Fedora 8&lt;br /&gt;
* - Or any other system with python 2.5 or above.&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE &amp;lt;b&amp;gt;YUM&amp;lt;/b&amp;gt; AND &amp;lt;b&amp;gt;RPM&amp;lt;/b&amp;gt; PACKAGES INSTALLED IN YOUR SYSTEM.&lt;br /&gt;
* This process uses a bash script which automates all the hard work made by hand in the manual install. It was successfully tested in several systems.&lt;br /&gt;
* If something goes wrong, or if you want to understand the way it works to install a diferent distribution, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.3.tar.gz setx86_64-0.3] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64-0.3.tar.gz&lt;br /&gt;
sh setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Press Enter and some tests are made to know if you can go on with the installation.&lt;br /&gt;
If you choose to go on with it, the script will download and patch everything for you.&lt;br /&gt;
All the vztemplates metadata available in openvz.org site are also installed and fixed for x86_64 system.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_11|STEP 11]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Error: Missing Dependency: cElementTree.so is needed by package vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedora&amp;lt;/b&amp;gt; or other distribution with yum, rpm and python (version 2.2, 2.3 or 2.4) installed, may be tried. You only have to change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
Install &amp;quot;vztmpl-centos-4&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
We only have to replace i386 references with x86_64 in all files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 cp -a i386 x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&amp;lt;br&amp;gt;&lt;br /&gt;
You can do the same procedure to other distro templates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:to&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{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.&lt;br /&gt;
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.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify the host rpm version:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;rpm --version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Centos-4 rpm is version 4.3.&lt;br /&gt;
&lt;br /&gt;
Edit this file /vz/template/centos/4/x86_64/config/rpm, and&lt;br /&gt;
you will see the number 43.&lt;br /&gt;
&lt;br /&gt;
When the host distro is the same of the template guest, everything would be correct, and we don't need doing anything.&amp;lt;br&amp;gt;&lt;br /&gt;
But if we have a different guest template, we might have to correct the values.&lt;br /&gt;
&lt;br /&gt;
We have to change the number inside /vz/template/&amp;lt;i&amp;gt;distro&amp;lt;/i&amp;gt;/&amp;lt;i&amp;gt;version&amp;lt;/i&amp;gt;/x86_64/config/rpm&lt;br /&gt;
according to the rpm version of the host system.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.4 the number would be 44.&amp;lt;br&amp;gt;&lt;br /&gt;
If rpm version is 4.3 the number would be 43.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This avoids the undesirable update of special MAKEDEV-swsoft to the real MAKEDEV from the distro yum repository during a vzyum action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other Operating Systems or other versions, you must verify which python version is installed in the host system. &lt;br /&gt;
Depending on that, the 32 bit files to be replaced are different (read the setx86_64-0.3 script, line 320 to line 345, to understand how it is done).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;background: white; border: 1px solid rgb(153, 153, 153); padding: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Someone reported the note below, but the tests I made, &amp;lt;u&amp;gt;didn't confirm&amp;lt;/u&amp;gt; it was really needed. Everything worked flawless without it.&amp;lt;br&amp;gt;&lt;br /&gt;
Nevertheless, if you find some problems, try the workaround described below:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;For CentOS-5, you will need to do something a bit different. &amp;quot;rpmmodule.so&amp;quot; is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
:rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The next piece of code fixed the vzyum bug described in [http://bugzilla.openvz.org/show_bug.cgi?id=488#c0 bugzilla #488].&amp;lt;br&amp;gt;&lt;br /&gt;
It was impossible to install a package group with spaces in his name.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we can use e.g. &amp;lt;b&amp;gt;vzyum groupinstall \&amp;quot;GNOME Desktop Environment\&amp;quot;&amp;lt;/b&amp;gt;, &lt;br /&gt;
or other group name listed in vzyum grouplist.&amp;lt;br&amp;gt;&lt;br /&gt;
(Don't forget the backslash before each doublequote)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 56:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
comment the line 56:&lt;br /&gt;
#exec $YUM $YUM_ARGS $USER_ARGS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Last Line (57):&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
add this code:&lt;br /&gt;
&lt;br /&gt;
TMPVZY=/tmp/tmpvzy.$$&lt;br /&gt;
echo $YUM $YUM_ARGS $USER_ARGS &amp;gt; $TMPVZY&lt;br /&gt;
sh $TMPVZY&lt;br /&gt;
exec rm -f $TMPVZY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 11 =====&lt;br /&gt;
&lt;br /&gt;
If you want your [[container]]s to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own template caches from your own templates.&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
List all x86_64 templates available:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls | grep x86_64&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Choose one of them to create the first cache template (this can be time consuming):&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It finishes with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; cache is created. Confirm if they were created:&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it in the cache list, then you can create your first [[container]]:&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start [[container]] 200 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in [[container]] 200:&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3039</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3039"/>
		<updated>2007-04-20T12:17:36Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: new script version. only installs centos-4 template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a Centos-4 (tested) or a Fedora Core distribution (not tested).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each VE using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - Centos-4 distribution (or Fedora Core 3, 4 or 5 - not tested).&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all VE's. Instead, each VE has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE YUM AND RPM PACKAGES INSTALLED IN YOUR SYSTEM, and if you want to install a Centos-4 cache template.&lt;br /&gt;
* This process uses a bash script that automatizes all the hard work made by hand in the manual install.&lt;br /&gt;
* If something goes wrong, or if you want to install a diferent cache template, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.2.tar.gz setx86_64] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64.tar.gz&lt;br /&gt;
./setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and let the script to do all the job for you.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_10|STEP 10]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&lt;br /&gt;
Error: Missing Dependency: cElementTree.so is needed by package vzyum&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vztmpl-centos-4 vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution (tested), but &amp;lt;b&amp;gt;Fedore Core&amp;lt;/b&amp;gt; or other distribution with yum and rpm installed, may be tried, if you change the reference name and version in STEPS 1 to 4 (this was not tested).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
If you didn't instal yet &amp;quot;vztmpl-centos-4&amp;quot;, do it now:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 mkdir x86_64&lt;br /&gt;
 cp -a /vz/template/centos/4/i386/* /vz/template/centos/4/x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| With this changes, vzyum is not going to be able to use a common cache directory to all VE's as it was used to do. Each VE will have it's own cache directory.&lt;br /&gt;
To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each VE, it is preferable to use the correct cache directory /var/cache/yum-cache.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
Substitute 32 bit module &amp;quot;rpmmodule.so&amp;quot; from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
If you want your VE's to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own cache your own cache templates&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
Make my first two cache templates:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-default&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They finish with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default&amp;lt;/b&amp;gt; cache are created. Confirm if they are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see the cache list, then you can create your first VE:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start VE 20 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in VE200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3016</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3016"/>
		<updated>2007-04-16T18:21:05Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: Use only Centos-4. Fedora was not tested successpully&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a Centos-4 (tested) or a Fedora Core distribution (not tested).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each VE using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - Centos-4 distribution (or Fedora Core 3, 4 or 5 - not tested).&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all VE's. Instead, each VE has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE YUM AND RPM PACKAGES INSTALLED IN YOUR SYSTEM, and if you want to install a Centos-4 cache template.&lt;br /&gt;
* This process uses a bash script that automatizes all the hard work made by hand in the manual install.&lt;br /&gt;
* If something goes wrong, or if you want to install a diferent cache template, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64.tar.gz setx86_64] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64.tar.gz&lt;br /&gt;
./setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter and let the script to do all the job for you.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_10|STEP 10]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&lt;br /&gt;
Error: Missing Dependency: cElementTree.so is needed by package vzyum&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vztmpl-centos-4 vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution (tested), but &amp;lt;b&amp;gt;Fedore Core&amp;lt;/b&amp;gt; or other distribution with yum and rpm installed, may be tried, if you change the reference name and version in STEPS 1 to 4 (this was not tested).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
If you didn't instal yet &amp;quot;vztmpl-centos-4&amp;quot;, do it now:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 mkdir x86_64&lt;br /&gt;
 cp -a /vz/template/centos/4/i386/* /vz/template/centos/4/x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| With this changes, vzyum is not going to be able to use a common cache directory to all VE's as it was used to do. Each VE will have it's own cache directory.&lt;br /&gt;
To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each VE, it is preferable to use the correct cache directory /var/cache/yum-cache.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
Substitute 32 bit module &amp;quot;rpmmodule.so&amp;quot; from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
If you want your VE's to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own cache your own cache templates&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
Make my first two cache templates:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-default&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They finish with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default&amp;lt;/b&amp;gt; cache are created. Confirm if they are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see the cache list, then you can create your first VE:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start VE 20 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in VE200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=2957</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=2957"/>
		<updated>2007-04-06T18:07:20Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: Install openvz on a x86 64 system centos moved to Install OpenVZ on a x86 64 system Centos-Fedora&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a Centos-4 or a Fedora Core distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each VE using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - Centos-4 or Fedora Core 3, 4 or 5 linux distribution.&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all VE's. Instead, each VE has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE YUM AND RPM PACKAGES INSTALLED IN YOUR SYSTEM, and if you want to install a Centos-4, or Fedora Core (3,4,5) cache template.&lt;br /&gt;
* This process uses a bash script that automatizes all the hard work made by hand in the manual install.&lt;br /&gt;
* If something goes wrong, or if you want to install a diferent cache template, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64.tar.gz setx86_64] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64.tar.gz&lt;br /&gt;
./setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you run the script, it asks first which OS Template do you want to install: Fedora or Centos.&lt;br /&gt;
Answer the question and enter the letter corresponding to you wish.&lt;br /&gt;
Let the script to do all the job for you.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_10|STEP 10]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&lt;br /&gt;
Error: Missing Dependency: cElementTree.so is needed by package vzyum&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vztmpl-centos-4 vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedore Core&amp;lt;/b&amp;gt; or other distribution with yum and rpm installed, can be used, if you change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
If you didn't instal yet &amp;quot;vztmpl-centos-4&amp;quot;, do it now:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 mkdir x86_64&lt;br /&gt;
 cp -a /vz/template/centos/4/i386/* /vz/template/centos/4/x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| With this changes, vzyum is not going to be able to use a common cache directory to all VE's as it was used to do. Each VE will have it's own cache directory.&lt;br /&gt;
To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each VE, it is preferable to use the correct cache directory /var/cache/yum-cache.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
Substitute 32 bit module &amp;quot;rpmmodule.so&amp;quot; from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
If you want your VE's to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own cache your own cache templates&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
Make my first two cache templates:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-default&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They finish with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default&amp;lt;/b&amp;gt; cache are created. Confirm if they are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see the cache list, then you can create your first VE:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start VE 20 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in VE200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Install_openvz_on_a_x86_64_system_centos&amp;diff=2958</id>
		<title>Install openvz on a x86 64 system centos</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Install_openvz_on_a_x86_64_system_centos&amp;diff=2958"/>
		<updated>2007-04-06T18:07:20Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: Install openvz on a x86 64 system centos moved to Install OpenVZ on a x86 64 system Centos-Fedora&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Install OpenVZ on a x86 64 system Centos-Fedora]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=2956</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=2956"/>
		<updated>2007-04-06T17:45:00Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: minimal change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a Centos-4 or a Fedora Core distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each VE using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - Centos-4 or Fedora Core 3, 4 or 5 linux distribution.&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all VE's. Instead, each VE has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE YUM AND RPM PACKAGES INSTALLED IN YOUR SYSTEM, and if you want to install a Centos-4, or Fedora Core (3,4,5) cache template.&lt;br /&gt;
* This process uses a bash script that automatizes all the hard work made by hand in the manual install.&lt;br /&gt;
* If something goes wrong, or if you want to install a diferent cache template, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64.tar.gz setx86_64] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64.tar.gz&lt;br /&gt;
./setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you run the script, it asks first which OS Template do you want to install: Fedora or Centos.&lt;br /&gt;
Answer the question and enter the letter corresponding to you wish.&lt;br /&gt;
Let the script to do all the job for you.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;[[#STEP_10|STEP 10]]&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&lt;br /&gt;
Error: Missing Dependency: cElementTree.so is needed by package vzyum&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vztmpl-centos-4 vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedore Core&amp;lt;/b&amp;gt; or other distribution with yum and rpm installed, can be used, if you change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
If you didn't instal yet &amp;quot;vztmpl-centos-4&amp;quot;, do it now:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 mkdir x86_64&lt;br /&gt;
 cp -a /vz/template/centos/4/i386/* /vz/template/centos/4/x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| With this changes, vzyum is not going to be able to use a common cache directory to all VE's as it was used to do. Each VE will have it's own cache directory.&lt;br /&gt;
To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each VE, it is preferable to use the correct cache directory /var/cache/yum-cache.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
Substitute 32 bit module &amp;quot;rpmmodule.so&amp;quot; from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
If you want your VE's to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own cache your own cache templates&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
Make my first two cache templates:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-default&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They finish with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default&amp;lt;/b&amp;gt; cache are created. Confirm if they are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see the cache list, then you can create your first VE:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start VE 20 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in VE200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=2955</id>
		<title>Using vzpkg and vzyum on x86 64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=2955"/>
		<updated>2007-04-06T17:31:59Z</updated>

		<summary type="html">&lt;p&gt;Mcarreira: create page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm.&lt;br /&gt;
This is intended to work in a Centos-4 or a Fedora Core distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== THE PROBLEM ==&lt;br /&gt;
&lt;br /&gt;
There is a known problem with &amp;lt;b&amp;gt;vzpkg-2.7.0&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;vzyum-2.4.0&amp;lt;/b&amp;gt; in x86_64 computers:&lt;br /&gt;
Vzyum, vzpkgcache and vzrpm are broken in 64 bit systems, so we are unable to create new cache templates in a x86_64 computer or update each VE using vzyum or vzrpm.&lt;br /&gt;
This text describes a work around and a few hacks to get it work flawless.&lt;br /&gt;
&lt;br /&gt;
{{Note| The basic idea is to change the code in such a way that vzyum and vzrpm use the real yum and rpm to do the job, and also create new x86_64 paths required by the system.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== REQUIREMENTS ==&lt;br /&gt;
&lt;br /&gt;
* - A x86_64 computer&lt;br /&gt;
* - Centos-4 or Fedora Core 3, 4 or 5 linux distribution.&lt;br /&gt;
* - Yum package installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SIDE EFFECTS ==&lt;br /&gt;
&lt;br /&gt;
Until now there is only one &amp;lt;i&amp;gt;side effect&amp;lt;/i&amp;gt; detected in this solution:&lt;br /&gt;
* The yum cache is not common to all VE's. Instead, each VE has it's own yum cache in the directory &amp;lt;code&amp;gt;/var/cache/yum-cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
This is a consequence from using the modified vzyum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== INSTALL Openvz ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to install it:&lt;br /&gt;
&lt;br /&gt;
* A - AUTOMATIC INSTALL (FASTEST)&lt;br /&gt;
* B - MANUAL INSTALL - STEP BY STEP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== A - AUTOMATIC INSTALL (FASTEST) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;General considerations&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system.&lt;br /&gt;
* You can only use the automatic install IF YOU HAVE YUM AND RPM PACKAGES INSTALLED IN YOUR SYSTEM, and if you want to install a Centos-4, or Fedora Core (3,4,5) cache template.&lt;br /&gt;
* This process uses a bash script that automatizes all the hard work made by hand in the manual install.&lt;br /&gt;
* If something goes wrong, or if you want to install a diferent cache template, it's better to do the manual install, and try to adapt it to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Procedure&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64.tar.gz setx86_64] and then untar and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf setx86_64.tar.gz&lt;br /&gt;
./setx86_64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you run the script, it asks first which OS Template do you want to install: Fedora or Centos.&lt;br /&gt;
Answer the question and enter the letter corresponding to you wish.&lt;br /&gt;
Let the script to do all the job for you.&lt;br /&gt;
&lt;br /&gt;
When it finishes with the message &amp;quot;END INSTALL&amp;quot;, you can go on reading this document jumping to the undermentioned &amp;lt;b&amp;gt;STEP 10&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== B - MANUAL INSTALL -STEP BY STEP ===&lt;br /&gt;
&lt;br /&gt;
If for any reason you prefer manual installation, you may start your install process the same way as described in [[Quick installation]].&lt;br /&gt;
In x86_64, the packages vzpkg, vzyum and vztmpl-* are broken. So, let's install them this way, to avoid problems:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vzrpm*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can't &amp;quot;yum install vzyum&amp;quot; because it breaks with an error:&lt;br /&gt;
Error: Missing Dependency: cElementTree.so is needed by package vzyum&lt;br /&gt;
&lt;br /&gt;
So we must download it first and then install it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
 rpm --nodeps -Uvh vzyum*.rpm&lt;br /&gt;
 yum install vztmpl-centos-4 vzpkg*&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== TWEAKING THE CODE ====&lt;br /&gt;
&lt;br /&gt;
Now let's tweak the code doing it step by step.&lt;br /&gt;
You can do a copy-paste from the next command lines to your system.&lt;br /&gt;
The example is using &amp;lt;b&amp;gt;Centos-4&amp;lt;/b&amp;gt; distribution, but &amp;lt;b&amp;gt;Fedore Core&amp;lt;/b&amp;gt; or other distribution with yum and rpm installed, can be used, if you change the reference name and version in STEPS 1 to 4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 1 =====&lt;br /&gt;
&lt;br /&gt;
If you didn't instal yet &amp;quot;vztmpl-centos-4&amp;quot;, do it now:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 yum install vztmpl-centos-4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 2 =====&lt;br /&gt;
&lt;br /&gt;
The template installed is a i386 template. So, we need to create a x86_64 template from the i386.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd /vz/template/centos/4/&lt;br /&gt;
 mkdir x86_64&lt;br /&gt;
 cp -a /vz/template/centos/4/i386/* /vz/template/centos/4/x86_64&lt;br /&gt;
 cd /vz/template/centos/4/x86_64/config&lt;br /&gt;
 sed -i.tmp 's/i386/x86_64/g' yum.conf&lt;br /&gt;
 rm -f yum.conf.tmp&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have a x86_64 centos template installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 3 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/yum.conf&amp;lt;/code&amp;gt; with your editor.&lt;br /&gt;
Change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/vz/template/centos/4/x86_64/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cachedir=/var/cache/yum-cache&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| With this changes, vzyum is not going to be able to use a common cache directory to all VE's as it was used to do. Each VE will have it's own cache directory.&lt;br /&gt;
To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each VE, it is preferable to use the correct cache directory /var/cache/yum-cache.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 4 =====&lt;br /&gt;
&lt;br /&gt;
If you list the directory vz-addons like this:&lt;br /&gt;
&lt;br /&gt;
 ls -l /vz/template/centos/4/x86_64/vz-addons&lt;br /&gt;
&lt;br /&gt;
probably you will see the file MAKEDEV-3.3.13-1.3.swsoft.i386.rpm.&lt;br /&gt;
This &amp;quot;ls&amp;quot; allows us to confirm which MAKEDEV version we need to use in this step.&lt;br /&gt;
&lt;br /&gt;
Edit the files &amp;lt;b&amp;gt;minimal.list&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default.list&amp;lt;/b&amp;gt; in /vz/template/centos/4/x86_64/config directory, and change the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEDEV&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
MAKEDEV-3.3.13 (or the version you saw in the &amp;quot;ls&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 5 =====&lt;br /&gt;
&lt;br /&gt;
Verify if you have &amp;lt;b&amp;gt;rpm-python&amp;lt;/b&amp;gt; installed in your system, because it has 64 bit module needed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rpm -q rpm-python&lt;br /&gt;
rpm-python-4.3.3-18_nonptl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install it if you didn't do it already:&lt;br /&gt;
 yum install rpm-python&lt;br /&gt;
&lt;br /&gt;
Substitute 32 bit module &amp;quot;rpmmodule.so&amp;quot; from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmmodule.so .&lt;br /&gt;
cp: overwrite `./rpmmodule.so'? y&lt;br /&gt;
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/rpmdb&lt;br /&gt;
cp /usr/lib64/python2.3/site-packages/rpmdb/_rpmdb.so .&lt;br /&gt;
cp: overwrite `./_rpmdb.so'? y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we must edit and change these 3 files described in the next steps:&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 6 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;cache-os&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 136:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: --vps=$VEID check-update&lt;br /&gt;
to: check-update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 185:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_CMD=&amp;quot;--installroot=$VE_ROOT --vps=$VEID $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
to: YUM_CMD=&amp;quot;--installroot=$VE_ROOT $YUM_CONF_FILE -y $YUM_CMD&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 7 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/share/vzpkg/&amp;lt;b&amp;gt;functions&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 21:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM=/usr/share/vzyum/bin/yum&lt;br /&gt;
to: YUM=`which yum`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 22:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: ARCHES=&amp;quot;x86 i386 x86_64 ia64&amp;quot;&lt;br /&gt;
to: ARCHES=&amp;quot;i386 x86_64 ia64 x86&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 111:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: export RPM=`get_rpm $tdir`&lt;br /&gt;
to: export RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 450:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: rpm=`get_rpm $tdir`&lt;br /&gt;
to: rpm=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 8 =====&lt;br /&gt;
&lt;br /&gt;
Edit the file /usr/bin/&amp;lt;b&amp;gt;vzyum&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 51:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT --vps=$VEID&amp;quot;&lt;br /&gt;
to: YUM_ARGS=&amp;quot;$YUM_ARGS --installroot $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 9 =====&lt;br /&gt;
&lt;br /&gt;
Edit file /usr/bin/&amp;lt;b&amp;gt;vzrpm&amp;lt;/b&amp;gt;&lt;br /&gt;
Change the next line:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 40:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM_ARGS=&amp;quot;--root $VE_ROOT --veid $VEID&amp;quot;&lt;br /&gt;
to: RPM_ARGS=&amp;quot;--root $VE_ROOT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; -Line 52:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
change: RPM=`get_rpm $TDIR`&lt;br /&gt;
to: RPM=`which rpm`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== STEP 10 =====&lt;br /&gt;
&lt;br /&gt;
If you want your VE's to have other country locales&lt;br /&gt;
edit &amp;lt;code&amp;gt;/vz/template/centos/4/x86_64/config/.rpmmacros&amp;lt;/code&amp;gt; and change the line &amp;lt;b&amp;gt;%_install_langs C&amp;lt;/b&amp;gt;&lt;br /&gt;
to the language you want, for example:&lt;br /&gt;
&lt;br /&gt;
%_install_langs C:pt_PT:pt_PT.UTF-8:en_US:en_US.UTF-8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TESTING THE NEW CODE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can create your own cache your own cache templates&lt;br /&gt;
Let's test it!&lt;br /&gt;
&lt;br /&gt;
Make my first two cache templates:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-default&lt;br /&gt;
 vzpkgcache -f centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They finish with complaints about &amp;lt;i&amp;gt;cron.daily&amp;lt;/i&amp;gt;, but don't worry about it.&lt;br /&gt;
Now &amp;lt;b&amp;gt;minimal&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;default&amp;lt;/b&amp;gt; cache are created. Confirm if they are created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzpkgls -c&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see the cache list, then you can create your first VE:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzctl create 200 --ostemplate centos-4-x86_64-minimal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To change the &amp;lt;i&amp;gt;locales&amp;lt;/i&amp;gt;, copy &amp;lt;code&amp;gt;/etc/sysconfig/i18n&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/vz/private/200/etc/sysconfig&amp;lt;/code&amp;gt;, if you wish to use another language and have done STEP 10 previously.&lt;br /&gt;
&lt;br /&gt;
Now start VE 20 previously created:&lt;br /&gt;
&lt;br /&gt;
 vzctl start 200&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then test also &amp;quot;vzyum&amp;quot; and see if it works. Try to install &amp;quot;nano editor&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzyum 200 install nano&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to use vzrpm, to list all rpm's installed in VE200:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 vzrpm 200 -qa&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you didn't have any errors, the changes are fine.&lt;br /&gt;
&lt;br /&gt;
If something went wrong, probably you made a mistake in those previous steps. &lt;br /&gt;
Carefully verify if you did it well, step by step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Mcarreira</name></author>
		
	</entry>
</feed>