Learning a little Xen on CentOS 5 Beta

| | |

Virtual Machine ManagerVirtual Machine ManagerI got a bit farther with Xen this time. I did another CentOS 5 Beta install and made sure to add the Virtualization package set. It's not like I needed to do another install but I've been doing a few installs just to test out differences with the various package sets.

I originally tried out Xen about a year and a half ago on a Fedora Core 4 host on rather underpowered hardware and a lot has changed since then.

Installing Fedora Core 6 into a Xen Virtual Machine

So there I am, in the graphical desktop on a machine running the Xen kernel. I ran the GUI Virtual Machine Manager again. I went through the various installation steps... give it a name, remote http URL for Fedora Core 6 install tree, creating a disk image, how much RAM (512MB), how many CPUs (1).

FC6 InstallFC6 InstallA new window appeared for the FC6 install process and I went with the default install which happens to include GNOME and OpenOffice.org... about 2GB of stuff. After about 30 minutes the install was done. That was a pretty silly selection because why would anyone wnat to run a desktop machine in Xen? ...but this is just a test.

One thing I did differently this time though is I added a line to the kernel command in the GRUB setup section:

console=xvnc0

According to the Release Notes for RHEL5 and CentOS 5 Beta, if you do a para-virtualized OS install (no VT support here)... you have to add console=xvnc0 as a kernel boot parameter in your virtual machine's GRUB config... if you want to be able to connect to the conole. I didn't notice that little piece of information last time. After the install as done, I clicked on the reboot now button to restart the machine the virtual machine.

Using the xm command

Ok, my machine shutdown after the install but it didn't start back up. Why is that? Well, again... according to the Release Notes, the Virtual Machine Manager doesn't have an equivalent for the xm create command which is the Xen way to start a virtual machine. Xen stores its configs in /etc/xen/ and in this case, since I named the machine devel4 there was a file there named devel4 which contains the Xen config for the virtual machine. So I read a little more about Xen and decided to do the following:

xm create -c devel4

That starts up the Xen machine and makes a console login prompt appear once the machine has booted. Bingo, it showed up as running in the Virtual Machine Manager. Since I remembered to put console=xvnc0 into the virtual machine's GRUB parameters, I was able to right-click on the virtual machine's name in the Virtual Machine Manager and select Open. Bingo, a window appeared showing FC6's graphical firstboot. I went through that and configured everything.

FC6 via VNCFC6 via VNCTurning off graphical login and connecting via VNC

Rather than waiting for graphical login screen to appear... I ssh'ed into the virtual machine, set the default runlevel to be 3 (edited /etc/inittab) and then did an init 3... making the graphical login go away. I Then I logged in as the user I had created during firstboot and I decided to use VNC to try out the graphical desktop so I ran vncpasswd and vncserver. I edited the ~/.vnc/xstartup and changed twm to gnome-session so it would load GNOME rather than twm. Again, why would one want to run a graphical environment in a Xen machine? They wouldn't... but with VNC one can run a graphical desktop on demand that can easily be accessed remotely.

Yum UpdatesYum UpdatesI believe I had to turn off the firewall on the Xen machine so it would allow me to connect to the VNC server I had started.

I ran yum to do system updates and there were approx. 467MB worth. Wow, I really should update my FC6 install tree on the fileserver to be based off of one of the FC6 respins, eh?

If I had to do it all over again

What would I do differently next time? I'd do a minimal install and eliminate runlevel 5 being the default, stopping the graphical boot, and avoid installing a few hundred packages that make up Xorg, GNOME and OpenOffice.org. After all, who wants to run a graphical desktop machine in a Xen virtual machine? Not me. Xen is for servers, right?

How is Xen different from VMware Server?

I'm glad you asked. :) Xen supposedly has a lot less overhead because it uses the hypervisor approach. A para-virtualized guest is an OS that is not only aware it is running in Xen but it has been modified to work better with Xen and as a result should be a lot closer to native OS performance than what VMware can offer. Now having said that, VMware does offer a more advanced product line than the free (as in beer) VMware Server... namely VMware ESX... which IS hypervisor based but retails for about $6,000. Any questions about the differences now?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I hope you may be able to help me

http://www.centos.org/modules/newbb/viewtopic.php?topic_id=12946

Scott,

I have seen your name in a quite a few XEN related posts and hope you have time to assist...

I'm quite new to Linux, and certainly new to ZEN (and virtual machines in general)

The above clearly covers Centos and I did follow another command line driven post that I believe from yourself..... neither appear to be quite 100%.....

Looking forward to your advice,

Colin


XEN Vs OpenVZ

is there ever a case for running XEN instead of OpenVZ?


Scott Dowdle's picture

A case for Xen?

First of all, I'm a big OpenVZ user and fan... but yes there are cases where Xen would be useful... in the areas where Machine Virtualization can do things that OS Virtualization can not.

For example:

1) Run different kernel versions

2) Run different operating systems

3) For specific (virtualized) hardware access that you may not have in OS Virtualization

Some people claim that there is also better isolation between machines with hardware virtualization... that is to say that if one machine crashes, it doesn't impact the others... but I really haven't had any problems with OS Virtualization not being stable and crashing.


Actually I am interested in ....

In your article, when discussing the installation of your second virtual machine you say, "That was a pretty silly selection because why would anyone wnat(sic) to run a desktop machine in Xen?"

I am actually interested in doing just that. As a hobby sys admin person for my lab, I am interested in efficient and stable system.

I am also interested in more desktop applications such as gmplayer. I find myself with my critical machine running FC4 and no possibility of maintenance.

The machine is well used by me and has been messed with and jerry-rigged by myself to run and do what I want it to do. There are minor installations here and rpms there from somewhat ramdom sources. I always have to mess with my LaTeX settings to get it print right. And redoing this gets old after a while. I want to be able to migrate to a newer system while still having a stable, reliable set up that will work when I absolutely need it.

To me that sounds interesting and useful and having just repartitioned a drive and installed CentOS5 with the xen kernel...


Scott Dowdle's picture

Yeah, it definitely wasn't

Yeah, it definitely wasn't one of my better ones... but I do like to self document the stuff I learn about so for me own purposes, it wasn't a complete waste of time. :)


this article is useless and

this article is useless and doesn't say anything informative.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.