Headless VM Server Using Ubuntu 11.10
In this tutorial I’ll be guiding you through setting up a headless Ubuntu 11.10 box that you’ll manage using virt-manager, accessed via X11. My main machine is a Mac running OSX Lion. You’ll need the Ubuntu CD, and for the first part of the tutorial, physical access to the box with a keyboard and monitor.
**Install Ubuntu on your server. **
I installed Ubuntu Desktop so I could mess with virt-manager before I disconnected everything. You won’t be using much of the deskop feature so it might not matter to you. Just make sure you install openssh-server so you can connect later on.
Check BIOS
I had purchased an HP desktop that shipped with virtualization disabled in the BIOS. You can check here to see if it’s enabled. You’ll need to look this up for your vendor.
egrep ‘(vmx|svm)’ /proc/cpuinfo
At this point you shouldn’t need to work directly on the box and everything else can be done over SSH.
Install KVM
They’ve done a fine job of documenting this in the Ubuntu guides. I won’t rehash what they’ve already done.
In addition to what they’ve provided, I suggest installing virt-manager. It’s life changing if you don’t want to spend a lot of time working on the command line with vmbuilder.
Set up bridged networking
I wrote a post on how to set up bridged networking in 10.10, the same instructions still apply.
Install virt-manager (or vmbuilder)
I’ve worked with both vmbuilder and virt-manager. Both are excellent tools. Virt-manager has an easier learning curve since it’s a GUI. Vmbuilder is great since it can do an automated build for you.
apt-get install virt-manager
Access virt-manager over X11
If you’re on a Mac, you’ll need to fix your X11 Preferences. I’ve done this under Lion - I think you might need to download XQuartz on older versions.Control - Alt won’t work to let you pop out of your virt-manager VNC sessions. Make sure “Option keys send Alt_L and Alt_R” is checked.
In X11, you should SSH to your VM box. Open a new window (Applications -> Terminal) and do the following:
bash-3.2$ ssh -X haddad-vmserver
Once you’re in there, fire up virt-manager
jhaddad@haddad-vmserver:~$ virt-manager
Create your new VM
You should now put your install ISO on your VM host, if you haven’t already. Create your new VM, picking RAM, hard disk, etc. I changed my network to use br0, my network bridge, instead of NAT.
It seems there’s a bug with VNC (at least with the version I’m using and my US keyboard). For some reason when connecting with VNC it couldn’t detect the ‘a’ key. Very strange. To fix, make sure to edit configuration before starting up.
You should now be looking at the install screen for whatever OS you’ve decided to boot up. Install as normal.
If you found this post helpful, please consider sharing to your network. I'm also available to help you be successful with your distributed systems! Please reach out if you're interested in working with me, and I'll be happy to schedule a free one-hour consultation.