Setting up a Virtual Computer with Xen (on Fedora) Part 1

If you haven’t done so already, install xen by typing

yum install xen

This will install xen as well as taking care of any needed dependencies. Now you need the xen-enabled kernel so type

yum install kernel-xen0

(That’s a zero there) While we’re waiting for that to install, it’s time to learn some Xen terminology. Xen causes all operating systems to run virtualized. This is why we need the xen kernel. It’s also why Xen is not available on Windows XP- you can’t virtualize an OS that doesn’t expect to be virtualized. However, there is still a primary OS and then a series of guest OSes, depending upon how many OSes you want to run and how much RAM you have. The primary OS is domain 0 and is referred to as dom0 online and pretty much everywhere I’ve read about Xen. All guest OSes are called domU. The first one is called dom0 because programmers start counting with 0. The guests are called domU because U stands for unpriveledged. Unpriviledged means they can’t reboot the physical computer and other such restrictions. Done? Good!

Now go to a terminal, become root, and type

less /boot/grub/grub.conf

to make sure an entry has been added for the Xen kernel. If you haven’t done too much mucking about in grub, default shoud be equal to one. To boot the xen kernel by default, change default so that it now equals 0. Now reboot to make sure this happens correctly. See you on the other side of the reboot!

Did you see all of the Xen messages upon boot? Good! You have that all set up correctly! Did it become a black screen that required you to hard reboot? No problem! Let’s change it to runlevel 3, as reccomended.

When GRUB comes up, hit enter to pick your kernel. Highlight the Xen kernel and hit e. Then select the second line from the bottom and hit e to edit that one. Get rid of rhgb and quiet at the end and put the number 3. Then hit b to boot. Things seem to run more smoothly on my screen too! (Before some of the boot text was colliding) This only changes it this one time, unfortunately, it seems to require being a permanent change, so you will have to edit grub.conf, as we did at the beginning.
At the login prompt login, su to root and type gdm to start up as usual. We just have one more thing to install before we get to the final step of setting up our first guest. This time

yum install vnc

Which installs vncviewer – the program used to graphically view your guest OSes. Now let’s make sure that Xen is properly running by typing, as root:

xm list

This should roughly say:

Name ID Mem(MiB) VCPUs State Time(s)

Domain-0 0 463 1 r—– 137.6

Alright! One of the hardest parts is over! Now, I don’t know how to install another flavor (distro) of Linux as the guest, although I’m 99% sure it’s possible. It’s just that all the How-Tos on the net seem to focus with Fedora users wanting Fedora domUs and Debian users wanting Debian domUs. Once I figure out an easy way to get another OS in there, I’ll let my readers know. So, on to installing another Fedora as a domU!

As root type

/usr/sbin/xenguest-install.py

and you get a few questions!

What is the name of your virtual machine? this is the name that will appear when you type xm list, so try to make it descriptive. In other words, if this virtual machine will be an internet server, name it so. If it is an email server, name it so.

How much RAM should be allocated? Red Hat reccomends at least 256 for their distros. It all depends on whether you want GUIs or not, but it is painful to attempt a GUI install with less than 256.

What would you like to use as the disk path? Where in your computer do you want the domU and what do you want the filename to be called? Try something like /home/myusername/nameIchoseinfirstquestion

How large would you like the disk to be? How big do you want the domU to think its hard drive is? At this point I don’t know if this can be resized, so be as generous as you can afford to be.

What is the install location? Where can Fedora find the files to install itself? So look online and find such a place – I found :

http://ftp.ale.org/mirrors/fedora/linux/core/5/i386/os/

Then I got an error about balloons! You just need to reduce the RAM your dom0 is taking. Issue the command:

xm mem-set 0 256

Now to continue the installation, type:

xm create -c nameofdomU

I got a boot loader error, which may result from the install being on the net. So I tried the creation step again to see if that would help. Never figured out why that didn’t work. After trying again from scratch it worked. I know there is a way to use Anaconda for the installation, but mine just kicked into an ncurses installation. Possibly, this is because of the source I am using, although I’m not sure. Oh, this was just to setup networking on the domU. This part is going extremely slow, I would recommending using wget to mirror an installation tree to your network for faster access.
Well, that’s where I have to stop for now. I’ve been doing this on a VMware image of Fedora so as not to disturb my working machine. However, there appear to be problems with the Xen image being able to access the net through VMWare and the install must be FTP, HTTP, or NFS. If there’s a way to install via CD, I haven’t found it yet. I’ll write up a part two once I figure out the next steps.

Author: Eric Mesa

To find out a little more about me, see About Me