<?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=Yogel</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=Yogel"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Yogel"/>
	<updated>2026-06-14T01:20:09Z</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=3345</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=3345"/>
		<updated>2007-07-20T13:25:48Z</updated>

		<summary type="html">&lt;p&gt;Yogel: /* STEP 5 */&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;
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;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Note&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
This script will almost work for CentOS-5, however it's not quite right (you will get some errors). You will also need to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which will cause it to resolve a dependency using your system wide python implementation&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;
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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&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 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>Yogel</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3344</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=3344"/>
		<updated>2007-07-20T13:25:14Z</updated>

		<summary type="html">&lt;p&gt;Yogel: /* A - AUTOMATIC INSTALL (FASTEST) */&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;
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;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Note&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
This script will almost work for CentOS-5, however it's not quite right (you will get some errors). You will also need to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which will cause it to resolve a dependency using your system wide python implementation&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;
For CentOS-5, you will need to do something a bit different. rpmmodule.so is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&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 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>Yogel</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3343</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=3343"/>
		<updated>2007-07-20T13:24:45Z</updated>

		<summary type="html">&lt;p&gt;Yogel: /* A - AUTOMATIC INSTALL (FASTEST) */&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;
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;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; This script will almost work for CentOS-5, however it's not quite right (you will get some errors). You will also need to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which will cause it to resolve a dependency using your system wide python implementation&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;
For CentOS-5, you will need to do something a bit different. rpmmodule.so is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&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 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>Yogel</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3342</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=3342"/>
		<updated>2007-07-20T13:24:30Z</updated>

		<summary type="html">&lt;p&gt;Yogel: /* A - AUTOMATIC INSTALL (FASTEST) */&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;
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;
&amp;lt;b&amp;gt;Note:&amp;lt;b&amp;gt; This script will almost work for CentOS-5, however it's not quite right (you will get some errors). You will also need to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which will cause it to resolve a dependency using your system wide python implementation&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;
For CentOS-5, you will need to do something a bit different. rpmmodule.so is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&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 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>Yogel</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_vzpkg_and_vzyum_on_x86_64&amp;diff=3341</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=3341"/>
		<updated>2007-07-20T13:23:18Z</updated>

		<summary type="html">&lt;p&gt;Yogel: /* STEP 5 */&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;
For CentOS-5, you will need to do something a bit different. rpmmodule.so is provided in your sitewide python distribution, so instead of copying it across, you need to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so&lt;br /&gt;
&amp;lt;/pre&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 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>Yogel</name></author>
		
	</entry>
</feed>