Learning a little Xen on CentOS 5 Beta

  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:0f210ef07a7561fbc5226129ca83efe7' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p><span class=\"inline right\"><a href=\"/\" onclick=\"launch_popup(204, 640, 512); return false;\" target=\"_blank\"><img src=\"http://www.montanalinux.org/files/images/centos5beta-xen01.thumbnail.jpg\" alt=\"Virtual Machine Manager\" title=\"Virtual Machine Manager\" class=\"image thumbnail\" width=\"100\" height=\"80\" /></a><span class=\"caption\" style=\"width: 98px;\">Virtual Machine Manager</span></span>I 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.</p>\n<p>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.</p>\n<p><b>Installing Fedora Core 6 into a Xen Virtual Machine</b></p>\n<p>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).</p>\n<p><span class=\"inline right\"><a href=\"/\" onclick=\"launch_popup(203, 640, 512); return false;\" target=\"_blank\"><img src=\"http://www.montanalinux.org/files/images/centos5beta-xen02.thumbnail.jpg\" alt=\"FC6 Install\" title=\"FC6 Install\" class=\"image thumbnail\" width=\"100\" height=\"80\" /></a><span class=\"caption\" style=\"width: 98px;\">FC6 Install</span></span>A 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.</p>\n<p>One thing I did differently this time though is I added a line to the kernel command in the GRUB setup section: </p>\n<p><code>console=xvnc0</code></p>\n<p>According to the <a href=\"http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/release-notes/RELEASE-NOTES-x86-en.html\" target=\"_rhel5rn\">Release Notes</a> for RHEL5 and CentOS 5 Beta, if you do a para-virtualized OS install (no VT support here)... you have to add <code>console=xvnc0</code> 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.</p>\n<p><b>Using the xm command</b></p>\n<p>Ok, my machine shutdown after the install but it didn\'t start back up. Why is that? Well, again... according to the <a href=\"http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/release-notes/RELEASE-NOTES-x86-en.html\" target=\"_rhel5rn\">Release Notes</a>, the Virtual Machine Manager doesn\'t have an equivalent for the <code>xm create</code> command which is the Xen way to start a virtual machine. Xen stores its configs in <code>/etc/xen/</code> and in this case, since I named the machine <code>devel4</code> there was a file there named <code>devel4</code> which contains the Xen config for the virtual machine. So I read a little more about Xen and decided to do the following:</p>\n<p><code>xm create -c devel4</code></p>\n<p>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 <code>console=xvnc0</code> 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 <code>firstboot</code>. I went through that and configured everything.</p>\n<p><span class=\"inline right\"><a href=\"/\" onclick=\"launch_popup(206, 640, 512); return false;\" target=\"_blank\"><img src=\"http://www.montanalinux.org/files/images/centos5beta-xen05.thumbnail.jpg\" alt=\"FC6 via VNC\" title=\"FC6 via VNC\" class=\"image thumbnail\" width=\"100\" height=\"80\" /></a><span class=\"caption\" style=\"width: 98px;\">FC6 via VNC</span></span><b>Turning off graphical login and connecting via VNC</b></p>\n<p>Rather than waiting for graphical login screen to appear... I ssh\'ed into the virtual machine, set the default runlevel to be 3 (edited <code>/etc/inittab</code>) and then did an <code>init 3</code>... making the graphical login go away. I Then I logged in as the user I had created during <code>firstboot</code> and I decided to use VNC to try out the graphical desktop so I ran <code>vncpasswd</code> and <code>vncserver</code>. I edited the <code>~/.vnc/xstartup</code> and changed <code>twm</code> to <code>gnome-session</code> 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.</p>\n<p><span class=\"inline right\"><a href=\"/\" onclick=\"launch_popup(205, 640, 512); return false;\" target=\"_blank\"><img src=\"http://www.montanalinux.org/files/images/centos5beta-xen04.thumbnail.jpg\" alt=\"Yum Updates\" title=\"Yum Updates\" class=\"image thumbnail\" width=\"100\" height=\"80\" /></a><span class=\"caption\" style=\"width: 98px;\">Yum Updates</span></span>I 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.</p>\n<p>I ran <code>yum</code> 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?</p>\n<p><b>If I had to do it all over again</b></p>\n<p>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?</p>\n<p><b>How is Xen different from VMware Server?</b></p>\n<p>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?</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:0f210ef07a7561fbc5226129ca83efe7' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:5b36e2d252dc60615e3f688c16c77af0' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p>http://www.centos.org/modules/newbb/viewtopic.php?topic_id=12946</p>\n<p>Scott,</p>\n<p>I have seen your name in a quite a few XEN related posts and hope you have time to assist...</p>\n<p>I\'m quite new to Linux, and certainly new to ZEN (and virtual machines in general)</p>\n<p>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%.....</p>\n<p>Looking forward to your advice,</p>\n<p>Colin</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:5b36e2d252dc60615e3f688c16c77af0' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:940426158d726c2561be8f651d819b85' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p>is there ever a case for running XEN instead of OpenVZ?</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:940426158d726c2561be8f651d819b85' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:350a07baff51f2e58814bcc5547970a3' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p>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.</p>\n<p>For example:</p>\n<p>1) Run different kernel versions</p>\n<p>2) Run different operating systems</p>\n<p>3) For specific (virtualized) hardware access that you may not have in OS Virtualization</p>\n<p>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.</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:350a07baff51f2e58814bcc5547970a3' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:4f88127ffffa254917df0b3f25a5795a' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p>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?\"</p>\n<p>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. </p>\n<p>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. </p>\n<p>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. </p>\n<p>To me that sounds interesting and useful and having just repartitioned a drive and installed CentOS5 with the xen kernel...</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:4f88127ffffa254917df0b3f25a5795a' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:14e9346e09465a5b9a18601df0adb57b' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p>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. :)</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:14e9346e09465a5b9a18601df0adb57b' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache WHERE cid = 'filter:1:da2b3480514531a2ae1b55546d2f79e4' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
  • user warning: Table 'cache' is marked as crashed and should be repaired query: UPDATE cache SET data = '<p>this article is useless and doesn\'t say anything informative.</p>\n<br class=\"clear\" />', created = 1411229283, expire = 1411315683, headers = '' WHERE cid = 'filter:1:da2b3480514531a2ae1b55546d2f79e4' in /home/dowdle/public_html/montanalinux/includes/database.mysql.inc on line 121.
| | |

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.