Editing How to use OpenVZ as a XEN guest OS (for x86 platform)
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: | ||
− | + | 1. Intro | |
Recently released RHEL5 kernel supports compatibility with XEN 3.0. It means that | Recently released RHEL5 kernel supports compatibility with XEN 3.0. It means that | ||
Line 21: | Line 21: | ||
</pre> | </pre> | ||
− | + | 2. Installing XEN itself, Dom0 and XEN tools. | |
− | XEN 3. | + | XEN 3.0 and XM tool can be installed in 2 ways: either from tarball containing prebuilt binaries or by building from sources. |
− | + | - Installing from tarball | |
− | + | Download XEN 3.1 32 bit PAE SMP tarball from http://bits.xensource.com/ and unpack: | |
− | Download XEN 3.1 32 bit PAE SMP tarball from | ||
<pre> | <pre> | ||
# cd xen | # cd xen | ||
# wget http://bits.xensource.com/oss-xen/release/3.1.0/bin.tgz/xen-3.1.0-install-x86_32p.tgz | # wget http://bits.xensource.com/oss-xen/release/3.1.0/bin.tgz/xen-3.1.0-install-x86_32p.tgz | ||
− | # tar | + | # gunzip xen-3.1.0-install-x86_32p.tgz |
+ | # tar -xvf xen-3.1.0-install-x86_32p.tar | ||
</pre> | </pre> | ||
− | |||
− | |||
Run the install.sh script within ./dist folder: | Run the install.sh script within ./dist folder: | ||
<pre> | <pre> | ||
Line 60: | Line 58: | ||
</pre> | </pre> | ||
install.sh checks the presence of the required packages and installs hypervisor xen.gz and XenLinux vmlinuz-2.6.16.33-xen | install.sh checks the presence of the required packages and installs hypervisor xen.gz and XenLinux vmlinuz-2.6.16.33-xen | ||
− | to /boot and xm tool to /usr/sbin. | + | to /boot and xm tool to /usr/sbin. Now update /etc/grub.conf by adding the xen entry in the following way: |
− | |||
− | |||
− | Now update /etc/grub.conf by adding the xen entry in the following way: | ||
/etc/grub.conf: | /etc/grub.conf: | ||
<pre> | <pre> | ||
− | title Xen Linux | + | title Xen Linux (2.6.16.33-xen) |
root (hd0,1) | root (hd0,1) | ||
− | kernel /boot/xen.gz dom0_mem= | + | kernel /boot/xen.gz dom0_mem=1048576 |
− | module /boot/vmlinuz-2.6-xen ro root=LABEL=/ silencelevel=8 | + | module /boot/vmlinuz-2.6.16.33-xen ro root=LABEL=/ console=ttyS0,115200 console=tty silencelevel=8 |
</pre> | </pre> | ||
− | + | Now you can reboot the machine. Choosing the Xen Linux (2.6.16.33-xen) from grub sequence will cause to booting xen hypervisor and Dom0 running Xen Linux (2.6.16.33-xen). In case of success you'll see the usual login prompt. If kernel panic takes place during boot - reboot the machine into your usual working Linux and check if the xen related /etc/grub.conf entry is correct. If /etc/grub.conf entry is correct and xen kernel is unable to boot,- the reason is prebuild vmlinuz-2.6.16.33-xen does not contain | |
− | |||
− | |||
− | |||
− | Now you can reboot the machine. Choosing the Xen Linux (2.6.16.33-xen) from grub sequence will cause to booting xen hypervisor and Dom0 running Xen Linux (2.6.16.33-xen). In case of success you'll see the usual login prompt. If kernel panic takes place during boot | ||
some drivers for your hardware, that are needed to be loaded by using initrd. In this case follow instructions below - "Building from sources". | some drivers for your hardware, that are needed to be loaded by using initrd. In this case follow instructions below - "Building from sources". | ||
− | + | - Building from sources | |
− | |||
Download the package containing sources of Xen-3.1 and unpack it: | Download the package containing sources of Xen-3.1 and unpack it: | ||
<pre> | <pre> | ||
# wget http://bits.xensource.com/oss-xen/release/3.1.0/src.tgz/xen-3.1.0-src.tgz | # wget http://bits.xensource.com/oss-xen/release/3.1.0/src.tgz/xen-3.1.0-src.tgz | ||
− | # tar | + | # gunzip xen-3.1.0-src.tgz |
+ | # tar -xvf xen-3.1.0-src.tar | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
Change directory to ./xen-3.1.0-src: | Change directory to ./xen-3.1.0-src: | ||
<pre> | <pre> | ||
Line 99: | Line 87: | ||
</pre> | </pre> | ||
Building process will do the following: | Building process will do the following: | ||
− | + | - build hypervizor xen.gz | |
− | + | - download linux kernel sources 2.6.16 from kernel.org, patch them with a set of xen patches | |
− | + | - from sources obtained build the vmlinuz-2.6.16.33-xen XenLinux kernel that will be able to boot both in Dom0 and DomU | |
− | + | - build and install xm tool | |
− | |||
After building is complete run ./install.sh script: | After building is complete run ./install.sh script: | ||
<pre> | <pre> | ||
# ./install.sh | # ./install.sh | ||
</pre> | </pre> | ||
− | As a result vmlinuz-2.6-xen, xen.gz will be placed to | + | As a result vmlinuz-2.6.16.33-xen, xen.gz will be placed to boot, xm tool will be placed to /usr/sbin. Now it is time to create initrd for vmlinuz-2.6.16.33-xen. Check that /lib/modules contain recently created directory 2.6.16.33-xen. If it is, type: |
<pre> | <pre> | ||
− | # mkinitrd -f -v /boot/initrd-2.6-xen.img 2.6. | + | # mkinitrd -f -v /boot/initrd-2.6.16.33-xen.img 2.6.16.33-xen |
</pre> | </pre> | ||
− | After initrd-2.6. | + | After initrd-2.6.16.33-xen.img is succesfully created update corresponding strings in /etc/grub.conf: |
<pre> | <pre> | ||
− | title Xen Linux | + | title Xen Linux (2.6.16.33-xen) |
root (hd0,1) | root (hd0,1) | ||
− | kernel /boot/xen.gz dom0_mem= | + | kernel /boot/xen.gz dom0_mem=1048576 |
− | module /boot/vmlinuz-2.6-xen ro root=LABEL=/ | + | module /boot/vmlinuz-2.6.16.33-xen ro root=LABEL=/ console=ttyS0,115200 console=tty silencelevel=8 |
− | module /boot/initrd-2.6-xen.img | + | module /boot/initrd-2.6.16.33-xen.img |
</pre> | </pre> | ||
− | Xen doesn't support TLS. To make xen work correct | + | Xen 3.0 doesn't support TLS. To make xen work correct disable TLS on your machine bu renaming /lib/tls to /lib/tls.disabled: |
<pre> | <pre> | ||
# mv /lib/tls /lib/tls.disabled | # mv /lib/tls /lib/tls.disabled | ||
</pre> | </pre> | ||
− | Check that kernel command line options are correct (after ro ...) and reboot the machine. In grub loader menu select "Xen Linux". In case of success - machine boots into Xen's Dom0 that is running XenLinux. Now it is time to prepare OpenVZ XenLinux kernel for DomU. | + | Check that kernel command line options are correct (after ro ...) and reboot the machine. In grub loader menu select "Xen Linux (2.6.16.33-xen)". In case of success - machine boots into Xen's Dom0 that is running vmlinuz-2.6.16.33-xen XenLinux. Now it is time to prepare OpenVZ XenLinux kernel for DomU. |
− | + | 3. Installing OpenVZ XenLinux kernel. | |
OpenVZ XenLinux kernel can be installed in 2 ways: either from rpm containing or by | OpenVZ XenLinux kernel can be installed in 2 ways: either from rpm containing or by | ||
building from sources. | building from sources. | ||
− | + | - install from rpm | |
− | + | Change directory to openvz and download rpm package with OpenVZ XenLinux kernel for x86: | |
− | + | <pre> | |
+ | # cd | ||
+ | # cd openvz | ||
+ | # wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab034.1/ovzkernel-PAE-2.6.18-8.el5.xen.028stab034.i686.rpm | ||
+ | </pre> | ||
Install downloaded rpm: | Install downloaded rpm: | ||
<pre> | <pre> | ||
− | # rpm -ihv ovzkernel-xen | + | # rpm -ihv ovzkernel-PAE-2.6.18-8.el5.xen.028stab033.i686.rpm |
</pre> | </pre> | ||
If something goes wrong during installation the prebuilt kernel - you can build the OpenVZ XenLinux kernel from sources as described below. | If something goes wrong during installation the prebuilt kernel - you can build the OpenVZ XenLinux kernel from sources as described below. | ||
− | + | - install from sources | |
− | |||
− | |||
+ | Download rpm with OpenVZ kernel sources: | ||
+ | <pre> | ||
+ | # wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab034.1/ovzkernel-2.6.18-8.el5.028stab034.1.src.rpm | ||
+ | </pre> | ||
Unpack downloaded rpm package: | Unpack downloaded rpm package: | ||
<pre> | <pre> | ||
− | # rpm2cpio ovzkernel- | + | # rpm2cpio ovzkernel-2.6.18-8.el5.028stab034.1.src.rpm > ovzkernel-2.6.18-8.el5.028stab034.1.src.cpio |
+ | # cpio -i < ovzkernel-2.6.18-8.el5.028stab034.1.src.cpio | ||
</pre> | </pre> | ||
Check that ./kernel-ovz.spec contains the following strings: | Check that ./kernel-ovz.spec contains the following strings: | ||
Line 189: | Line 183: | ||
OpenVZ XenLinux kernel prepared. Now OpenVZ tools are to be installed. In case you faced problem while building the kernel turn to article http://wiki.openvz.org/Kernel_build . | OpenVZ XenLinux kernel prepared. Now OpenVZ tools are to be installed. In case you faced problem while building the kernel turn to article http://wiki.openvz.org/Kernel_build . | ||
− | + | - install OpenVZ tools: | |
Now download and install latest versions of OpenVZ tools vzctl, vzquota that are necessary for starting/stopping VEs: | Now download and install latest versions of OpenVZ tools vzctl, vzquota that are necessary for starting/stopping VEs: | ||
Line 200: | Line 194: | ||
More information on installing OpenVZ tools can be found here: http://wiki.openvz.org/Quick_installation. | More information on installing OpenVZ tools can be found here: http://wiki.openvz.org/Quick_installation. | ||
− | + | - download OpenVZ guest template | |
To make it possible to create VEs download one of the precreated OpenVZ templates and place it to /vz/template/cache: | To make it possible to create VEs download one of the precreated OpenVZ templates and place it to /vz/template/cache: | ||
Line 208: | Line 202: | ||
</pre> | </pre> | ||
− | + | 4. Preparing guest partition and configuring XEN. | |
Xen users manual http://www.xensource.com/products/xen/documentation.html describes a set of different ways of creating disk for DomU. Disk can be created using loopback or LVM or physical partition. Consider we have a standalone physical partition /dev/sda7 that will be used for creating DomU disk. Assume /dev/sda7 is empty and it contains ext3 filesystem. | Xen users manual http://www.xensource.com/products/xen/documentation.html describes a set of different ways of creating disk for DomU. Disk can be created using loopback or LVM or physical partition. Consider we have a standalone physical partition /dev/sda7 that will be used for creating DomU disk. Assume /dev/sda7 is empty and it contains ext3 filesystem. | ||
Line 282: | Line 276: | ||
Preparations completed. At this point we have everything that is necessary for cretaing DomU and starting OpenVZ XenLinux within DomU. Reboot into Xen: select Xen Linux (2.6.16.33-xen) item from grub menu. After reboot machine will be running vmlinuz-2.6.16.33-xen (see above) in Dom0 over hypervisor. Follow instructions below. | Preparations completed. At this point we have everything that is necessary for cretaing DomU and starting OpenVZ XenLinux within DomU. Reboot into Xen: select Xen Linux (2.6.16.33-xen) item from grub menu. After reboot machine will be running vmlinuz-2.6.16.33-xen (see above) in Dom0 over hypervisor. Follow instructions below. | ||
− | + | 5. Starting OpenVZ guest in DomU. | |
− | + | - starting | |
Start xend daemon to make xm tool work: | Start xend daemon to make xm tool work: | ||
Line 350: | Line 344: | ||
It works. | It works. | ||
− | + | - next steps | |
As OpenVZ works in DomU it is the best time for configuring network both in DomU and VEs. This process is described in http://www.xensource.com/products/xen/documentation.html (DomU) and http://wiki.openvz.org/Category:Networking (VEs). After this all of us will feel the full power of virtualization! | As OpenVZ works in DomU it is the best time for configuring network both in DomU and VEs. This process is described in http://www.xensource.com/products/xen/documentation.html (DomU) and http://wiki.openvz.org/Category:Networking (VEs). After this all of us will feel the full power of virtualization! | ||
− | + | 6. RHEL5 based OpenVZ in Dom0. Known problems. | |
OpenVZ XenLinux kernel is able to work also in Dom0. It can be tested just by updating /etc/grub.conf on the hardware node. But in this case it will be impossible to start DomUs. It is a known bug and it is related not to OpenVZ, but to RHEL5 kernel. | OpenVZ XenLinux kernel is able to work also in Dom0. It can be tested just by updating /etc/grub.conf on the hardware node. But in this case it will be impossible to start DomUs. It is a known bug and it is related not to OpenVZ, but to RHEL5 kernel. | ||
Hope it is fixed in next RHEL5 update. | Hope it is fixed in next RHEL5 update. | ||
− | + | 7. Appreciates | |
Thanks to Sergey Ya. Korshunoff seyko@ for starting the topic and contribution. | Thanks to Sergey Ya. Korshunoff seyko@ for starting the topic and contribution. |