Editing Using vzpkg and vzyum on x86 64
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | This document describes a way to install OpenVZ in a x86_64 computer, so that it can create cache templates, use vzyum and vzrpm. | |
+ | This is intended to work in a Centos-4 (tested) or a Fedora Core distribution (not tested). | ||
− | |||
− | |||
− | |||
− | |||
− | |||
== THE PROBLEM == | == THE PROBLEM == | ||
Line 20: | Line 16: | ||
* - A x86_64 computer | * - A x86_64 computer | ||
− | * - | + | * - Centos-4 distribution (or Fedora Core 3, 4 or 5 - not tested). |
* - Yum package installed. | * - Yum package installed. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== SIDE EFFECTS == | == SIDE EFFECTS == | ||
Until now there is only one <i>side effect</i> detected in this solution: | Until now there is only one <i>side effect</i> detected in this solution: | ||
− | * The yum cache is not common to all [[container]]s. Instead, each [[container]] has | + | * The yum cache is not common to all [[container]]s. Instead, each [[container]] has it's own yum cache in the directory <code>/var/cache/yum-cache</code>. |
This is a consequence from using the modified vzyum. | This is a consequence from using the modified vzyum. | ||
+ | |||
== INSTALL Openvz == | == INSTALL Openvz == | ||
Line 64: | Line 41: | ||
* This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system. | * This is a fastest way to install openvz utilities, and template utilities, ready to use in a x86_64 system. | ||
− | * You can only use the automatic install IF YOU HAVE | + | * 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. |
− | * This process uses a bash script | + | * This process uses a bash script that automatizes all the hard work made by hand in the manual install. |
− | * If something goes wrong, or if you want | + | * 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. |
Line 72: | Line 49: | ||
* 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. | * Read carefully the [[Quick installation]] page and install the openvz kernel, configure the bootloader, change sysctl.conf, and finally reboot your system the way it is described there. | ||
− | * Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0. | + | * Download the file [http://linux.carreira.com.pt/ovzutils/setx86_64-0.2.tar.gz setx86_64] and then untar and run the script: |
<pre> | <pre> | ||
− | tar xzvf setx86_64 | + | tar xzvf setx86_64.tar.gz |
− | + | ./setx86_64 | |
</pre> | </pre> | ||
+ | Press Enter and let the script to do all the job for you. | ||
− | + | When it finishes with the message "END INSTALL", you can go on reading this document jumping to the undermentioned <b>[[#STEP_10|STEP 10]]</b>. | |
− | |||
− | |||
− | + | <b><u>Note</u></b> | |
+ | This script will almost work for CentOS-5, however it's not quite right (you will get some errors). You will also need to: | ||
+ | <pre> | ||
+ | rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so | ||
+ | </pre> | ||
+ | which will cause it to resolve a dependency using your system wide python implementation | ||
=== B - MANUAL INSTALL -STEP BY STEP === | === B - MANUAL INSTALL -STEP BY STEP === | ||
Line 95: | Line 76: | ||
</code> | </code> | ||
− | We can't "yum install vzyum" because it breaks with an error: | + | We can't "yum install vzyum" because it breaks with an error: |
− | + | Error: Missing Dependency: cElementTree.so is needed by package vzyum | |
So we must download it first and then install it. | So we must download it first and then install it. | ||
Line 103: | Line 84: | ||
wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm | wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm | ||
rpm --nodeps -Uvh vzyum*.rpm | rpm --nodeps -Uvh vzyum*.rpm | ||
− | yum install vzpkg* | + | yum install vztmpl-centos-4 vzpkg* |
</code> | </code> | ||
Line 111: | Line 92: | ||
Now let's tweak the code doing it step by step. | Now let's tweak the code doing it step by step. | ||
You can do a copy-paste from the next command lines to your system. | You can do a copy-paste from the next command lines to your system. | ||
− | The example is using <b>Centos-4</b> distribution, but <b> | + | The example is using <b>Centos-4</b> distribution (tested), but <b>Fedore Core</b> 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). |
===== STEP 1 ===== | ===== STEP 1 ===== | ||
− | + | If you didn't instal yet "vztmpl-centos-4", do it now: | |
<code> | <code> | ||
yum install vztmpl-centos-4 | yum install vztmpl-centos-4 | ||
</code> | </code> | ||
− | |||
− | |||
Line 128: | Line 107: | ||
The template installed is a i386 template. So, we need to create a x86_64 template from the i386. | The template installed is a i386 template. So, we need to create a x86_64 template from the i386. | ||
− | |||
<code> | <code> | ||
cd /vz/template/centos/4/ | cd /vz/template/centos/4/ | ||
− | cp -a i386 x86_64 | + | mkdir x86_64 |
+ | cp -a /vz/template/centos/4/i386/* /vz/template/centos/4/x86_64 | ||
cd /vz/template/centos/4/x86_64/config | cd /vz/template/centos/4/x86_64/config | ||
sed -i.tmp 's/i386/x86_64/g' yum.conf | sed -i.tmp 's/i386/x86_64/g' yum.conf | ||
Line 138: | Line 117: | ||
</code> | </code> | ||
− | Now we have a x86_64 centos template installed | + | Now we have a x86_64 centos template installed. |
− | |||
Line 147: | Line 125: | ||
Change the line: | Change the line: | ||
− | + | <code>cachedir=/vz/template/centos/4/x86_64/yum-cache</code> | |
− | + | to | |
− | + | <code>cachedir=/var/cache/yum-cache</code> | |
− | {{Note| | + | {{Note| With this changes, vzyum is not going to be able to use a common cache directory to all [[container]]s as it was used to do. Each [[container]] will have it's own cache directory. |
− | To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each [[container]], it is preferable to use the correct cache directory /var/cache/yum-cache | + | To avoid to have a directory named /vz/template/centos/4/x86_64/yum-cache in each [[container]], it is preferable to use the correct cache directory /var/cache/yum-cache.}} |
− | |||
− | |||
===== STEP 4 ===== | ===== STEP 4 ===== | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
If you list the directory vz-addons like this: | If you list the directory vz-addons like this: | ||
Line 199: | Line 153: | ||
MAKEDEV-3.3.13 (or the version you saw in the "ls") | MAKEDEV-3.3.13 (or the version you saw in the "ls") | ||
</pre> | </pre> | ||
− | |||
− | + | ===== STEP 5 ===== | |
− | ===== STEP | ||
Verify if you have <b>rpm-python</b> installed in your system, because it has 64 bit module needed: | Verify if you have <b>rpm-python</b> installed in your system, because it has 64 bit module needed: | ||
Line 216: | Line 168: | ||
yum install rpm-python | yum install rpm-python | ||
− | + | Substitute 32 bit module "rpmmodule.so" from vzrpm43-python to the 64 bit module that rpm-python-x86_64 provides, using this method: | |
<pre> | <pre> | ||
− | |||
cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/ | cd /usr/share/vzpkgtools/vzrpm43/lib/python2.3/site-packages/ | ||
cp /usr/lib64/python2.3/site-packages/rpmmodule.so . | cp /usr/lib64/python2.3/site-packages/rpmmodule.so . | ||
Line 228: | Line 179: | ||
</pre> | </pre> | ||
− | + | 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: | |
− | |||
− | + | <pre> | |
− | + | rm /usr/share/vzpkgtools/vzrpm43/lib/python2.4/site-packages/rpmmodule.so | |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | |||
Line 252: | Line 194: | ||
/usr/bin/<b>vzyum</b> | /usr/bin/<b>vzyum</b> | ||
− | ===== STEP | + | ===== STEP 6 ===== |
− | Edit the file /usr/share/vzpkg/<b>cache-os</b | + | Edit the file /usr/share/vzpkg/<b>cache-os</b> |
Change the next lines: | Change the next lines: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<b> -Line 136:</b> | <b> -Line 136:</b> | ||
Line 273: | Line 206: | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
<b> -Line 185:</b> | <b> -Line 185:</b> | ||
Line 285: | Line 214: | ||
− | ===== STEP | + | ===== STEP 7 ===== |
− | Edit the file /usr/share/vzpkg/<b>functions</b | + | Edit the file /usr/share/vzpkg/<b>functions</b> |
Change the next lines: | Change the next lines: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 326: | Line 248: | ||
− | ===== STEP | + | ===== STEP 8 ===== |
− | Edit the file /usr/bin/<b>vzyum</b | + | Edit the file /usr/bin/<b>vzyum</b> |
Change the next line: | Change the next line: | ||
Line 339: | Line 261: | ||
− | + | ===== STEP 9 ===== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ===== STEP | ||
Edit file /usr/bin/<b>vzrpm</b> | Edit file /usr/bin/<b>vzrpm</b> | ||
− | Change next line: | + | Change the next line: |
Line 383: | Line 281: | ||
− | ===== STEP | + | ===== STEP 10 ===== |
If you want your [[container]]s to have other country locales | If you want your [[container]]s to have other country locales | ||
Line 392: | Line 290: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== TESTING THE NEW CODE == | == TESTING THE NEW CODE == | ||
Line 411: | Line 297: | ||
Let's test it! | Let's test it! | ||
− | + | Make my first two template caches: | |
− | |||
+ | vzpkgcache -f centos-4-x86_64-default | ||
+ | vzpkgcache -f centos-4-x86_64-minimal | ||
− | |||
− | + | They finish with complaints about <i>cron.daily</i>, but don't worry about it. | |
+ | Now <b>minimal</b> and <b>default</b> cache are created. Confirm if they are created: | ||
− | + | vzpkgls -c | |
− | |||
− | |||
+ | If you see the cache list, then you can create your first [[container]]: | ||
− | |||
vzctl create 200 --ostemplate centos-4-x86_64-minimal | vzctl create 200 --ostemplate centos-4-x86_64-minimal | ||
Line 440: | Line 325: | ||
Then test also "vzyum" and see if it works. Try to install "nano editor": | Then test also "vzyum" and see if it works. Try to install "nano editor": | ||
+ | |||
vzyum 200 install nano | vzyum 200 install nano | ||
Line 445: | Line 331: | ||
Try to use vzrpm, to list all rpm's installed in [[container]] 200: | Try to use vzrpm, to list all rpm's installed in [[container]] 200: | ||
+ | |||
vzrpm 200 -qa | vzrpm 200 -qa | ||
Line 453: | Line 340: | ||
If something went wrong, probably you made a mistake in those previous steps. | If something went wrong, probably you made a mistake in those previous steps. | ||
Carefully verify if you did it well, step by step. | Carefully verify if you did it well, step by step. | ||
+ | |||