You are here: Home Tech Xen and the art of CentOS maintenance

Xen and the art of CentOS maintenance

by Chris Shenton last modified Aug 27, 2010 05:42 PM
My initial foray into running Xen: much easier on Centos 5.5 than Ubuntu 10.05 so far

I installed Ubuntu-10.04 and then floundered trying to figure out how to install Xen. Being new to Xen, this wasn't surprising, but the docs I could find were contradictory.  Several indicated I had to compile a new kernel, and as a die-hard FreeBSD bigot, this wan't too intimidating, but sure seemed harder than it should.

So I tried Centos-5.5, and one of the install options was to enable Virtualization, which sounded right. I don't know which of the many forms it decided to enable, but when I booted up, dmesg tells me a Xen kernel is in there. 

I can run "sudo /usr/sbin/xm list" and see no machines, at least the command doesn't bomb (like it did in Ubuntu).  

Next step is to create a VM. I want one for Zenoss, and another for a customer site we're working on.  Might as well use Centos for them too.

You can use the "--prompt" option but given how many times I'd failed already, I tried it all on one command line: name of VM is "zenoss", 1024MB RAM, use image file specified with 10GB size, and get the distro from the named URL:

[chris@navaja ~]$ sudo virt-install -n zenoss -r 1024 -f /vm/zenoss.img -s 10 -l http://centos.aol.com/5.5/os/i386/
Starting install...
ERROR    Invalid install location: Opening URL http://centos.aol.com/5.5/os/i386 failed.
...
ValueError: Invalid install location: Opening URL http://centos.aol.com/5.5/ failed.

After many URL variants, I tried a simple "curl" to ensure reachability... and found that I had never set up /etc/resolv.conf to point at my nameserver. Doh!

Fixing that made the install start up fine. Useless error messages considered harmful.

 It begins with a CentOS textual selection of language and variant, then surprisingly, fired up a GUI, which -- since I was remote -- came in over an SSH tunnel.  It was a bit slow and some of the mouse click interaction felt awkward.  Dunno if it's the remote X11-over-ssh that's weird or something else, but kinda striking that it works at all... like a dancing bear.

After some hitting RETURN to accept defaults it fails with

Input/output error during read on /dev/xvda

No idea about that one yet.

So I tried it from the CentOS console itself, but had to give a new name and disk location since it knew about the other ones already.

sudo virt-install -n zenoss2 -r 1024 -f /vm/zenoss2.img -s 10 -l http://centos.aol.com/5.5/os/i386/

And this went off without any complaints about /dev/xvda. Don't know.

The CentOS installer opened up another window and began installing. I did not have to manually create an .img files with "dd", as many docs indicate you must.

I accidentally hit ^C while it was running, then ran "sudo virt-manager" which fired up a GUI showing my abortive "zenoss" machine (stopped) and the new "zenoss2" machine -- which it showed as running. Clicking on that line brought up the console, which was still doing the install of CentOS guest despite my accidental attempts to kill it. Sweet.

And SOooo much better than VMware which requires a Windows box to run the client that talks to the VMware master. (Why would I ever run Windows to manage UNIX VMs??)

I have some things to learn about Linux and CentOS -- like how to tell it to not install stuff like OpenOffice that I don't want on my server...

While I can't use the GUI to create new VMs -- at least not this GUI, perhaps there's another -- I can manage existing ones; it's surprisingly nice.

I create another with the CLI tool. This one I'll set as a server with any *GUI checkboxes unchecked.  I see it retrieves images and other large files, presumably across the interwebs -- not exacly fast. I expect if I had tthem locally installed I could install more quickly.

Total time to create VM and then install Centos (server, no GUI) was under 20 minutes.

 Here's another example with more verbose command line options:

sudo virt-install \
 --name=epa-oracle \
 --os-type=linux  \
 --os-variant=rhel5.4 \ 
 --ram=1024 \
 --disk path=/vm/epa-oracle,size=20 \ 
 --accelerate \
 --vnc \
 --location=http://centos.aol.com/5.5/os/i386/

 

 

Share this: