Xen
From FrugalWiki
Dansk – Deutsch – English – Español – Français – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Polski – Português – Română – Slovenský – Suomi – Svenska – Türkçe – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어
Contents |
Xen
Xen is a virtualization technology which gives huge speed increases over other virtualization software such as VMware and QEMU. For more info on what Xen is, look at XenSource
Running Frugalware as a domain 0 system (host system)
The domain 0 system is your existing system, which you need to set up to run a modified kernel inside the Xen hypervisor. The hypervisor gets loaded before the Linux kernel, and it has control over your virtual machines. In effect, domain 0 is a virtual machine, except it has full access to your hardware and has full control over the hypervisor.
To run Frugalware as the host Xen system, follow these steps.
1. From a terminal, run:
If you would like a GUI interface for Xen (recommended) run:
2. Open /boot/grub/menu.lst as root in an editor (nano is used as an example here):
Append the following lines to it:
title Frugalware 0.6pre1 (Terminus) - Xen enabled kernel (hd0,1)/boot/xen.gz noreboot dom0_mem=384M module (hd0,1)/boot/vmlinuz-2.6.19-xen0-fw2 ro root=/dev/hda2
On the line beginning with 'module', change /dev/hda2 to your root device. On the line beginning with 'kernel', change 384M to the amount of memory you would like to assign to your host system. A sensible choice would be half of your total memory. On both lines, change (hd0,1) to the GRUB name for your boot partition (you can look at your existing entry in menu.lst to find this value)
Save and exit
3. Add the Xen daemon to run at bootup with the following command:
4. Modify the Xen daemon configuration of required:
5. Reboot and select the Xen option from the GRUB menu.
Warnings
Xen can be unstable, and may cause data loss, etc. Frugalware or XenSource cannot be held responsible for any data loss encountered while using Xen. Listed below are issues that I know of.
- Do NOT *EVER* attempt to perform partitioning operations while running in Xen mode. I totally trashed my Frugalware system by attempting to partition my disk while running Xen. (This occurred for me when using Xen 3.0.0 and kernel 2.6.12. I'm not sure if it still happens with the latest version, and I'm not going to try, if you see what I mean)
- Don't attempt to install the nvidia binary drivers while running Xen. This caused my machine to lock up.
Running Frugalware as a domain U system (client system)
Now that you have the Xen hypervisor set up, you can run Frugalware in a guest system. This is a very easy process thanks to the mkfwxenU script. Sometime this script will be available in the Frugalware repos but for now you will need to download it from it's development repo
pacman -S darcs darcs get http://ftp.frugalware.org/pub/other/people/alex/mkfwxenU cd mkfwxenU/src chmod 755 mkfwxenU ./mkfwxenU
This will help you to set u 1000 p a Frugalware image for Xen and create a Xen configuration file. If you plan to use virt-manager for the virtual machine, you need to say Y when it asks you about VNC.
Alternate networking approaches
In some cases the network-bridge solution is not the best. For example, it does not work here. What works for me is network-nat. This basically makes your VM appear on the network with the same IP address as the dom0 system. This can be useful if you are running Xen on a colocated server and you only have 1 IP address available. Setting it up is quite simple.
1. Open /etc/xen/xend-config.sxp as root in your favourite editor
2. Find this line and comment it out with a #:
(network-script network-bridge)
3. Find this line and comment it out with a #:
(vif-script vif-bridge)
4. Find these 2 lines and remove the # from in front of them:
# (network-script network-nat) # (vif-script vif-nat)
5. Save the file and exit
6. Make sure iptables is installed.
7. Reboot into your Xen kernel.
Now you must modify the domU config file. Make sure the domain is not running with xm list. Then open it's config file in your favourite editor. Find the vif line and change it to this:
vif = [ 'ip=10.0.0.1' ]
Note: If you have more than one VM, you must increment the last value of the IP address for each one.
Now start the virtual machine and run netconfig in it. Select eth0 as the interface and static as the configuration type. Set the IP address to match the IP address in the vif line in the config file. Set the netmask to 255.0.0.0 and the gateway to 10.0.0.254 . When it asks you for the nameserver, you should set it to use the same nameserver as your dom0 system. You can find this out by looking at dom0's /etc/resolv.conf file. Restart the VM and networking should work.
If you want to be able to forward ports on the domain 0 system to a domU system, take a look at this page
X in a domU system
You need VNC enabled for this to work. If it is not enabled, put this line in your domU's config file:
vnc = 1
Now start up the VM and log in. Use pacman to install the desktop environment of your choice as well as xf86-video-fbdev
Do NOT create an X config file now, the X defaults will work fine. Run init 4 to test. A display manager should appear. If you want to start X at every boot, shut down the virtual machine and open it's config file. Find the extra line and change the 3 to a 4