Virtual Machine systems have been popular for servers for a few years now. They save big time $$ when setting up server rooms since most of the server systems in an IT shop aren’t that busy. But recently VM has become popular for desktop users. Many of the reasons we used to use “Dual-Boot” systems are much better served using VM. There are several reasons why you might want to run VM on your system:
- You have a windows system and want to run Ubuntu.
- You have a Mac and want to run Windows occasionally.
- You have Windows, or a Mac, and want to have a system where you can surf safely, for example to do your online banking.
- You are doing development and want to have a “clean” system for testing.
One of the most functional, and easiest to deploy, VM systems is VirtualBox. Now inside Oracle, this system was originally developed at Sun and is Open Source, and free. Microsoft has Windows Virtual PC, and you can run Windows XP or Ubuntu on your Vista or Windows 7 system. But of course, it has no support for Ubuntu or OS/X as a host, so why learn more than one system? I’m going to use Windows and Ubuntu systems as hosts, so I’ve chosen VirtualBox.
Hosts and Guests
The terms are Host and Guest. Host is the system that is running directly on the hardware. The Guest is the system that is running in a “virtual machine”.
As a user, you probably have a Windows Host – your usual reasonably modern Windows system. It should be a hardware box purchased in the last three or four years. Systems older than that may not have the virtual machine processor extensions that make things a lot faster. While VM may work on older processors, it is probably worth while.
As a Mac user, you may want to run Windows in a VM on your Mac. I’m not an expert here, but you are going to find lots of material on the web to solve your problem, and don’t forget to check out the dozens of YouTube videos that show how to install Windows in your Mac in a VM.
Increasingly, there are viruses out there that target users that do online banking. These viruses get into your system and hide, using root-kits, so that not even your anti-virus software can see them. Then when you log into your bank, they watch your connection and transfer all your money off-shore while you are online. Before you know it, your bank account is empty.
One way to thwart these viruses is to do all your banking from a system that the virus cannot attack. I’ve not heard of any of these attacks being done on Linux systems, so that doing all your banking from Ubuntu may be a safer bet.
VMs like VirtualBox make running an Ubuntu system much easier. There are quite a few YouTube videos and other web pages out there showing you how to install an Ubuntu system in a VM on your Windows Laptop or Desktop machine.
Using VMs for Development
I am recently writing programs, most of which are portable on both Windows and Linux. I have some Linux hardware systems, but it is more convenient to do my code writing on my laptop, so I wanted a VM running an Ubuntu system. VirtualBox is just the ticket.
When I was studying the problem, the searches came up with Xen first. When there are lots of gray boxes in the documentation containing command line scripts that must be run to install a product, it is a bad sign. Xen requires recompiling the Linux Kernel. There must be a better way.
And there is. VirtualBox hosts on Windows, Ubuntu [and other Linux flavors] and OS/X. And it guests those systems too.
Windows Host, Ubuntu Guest
I started with a Windows Vista host and Ubuntu 11.04 Guest. VirtualBox installation is quite simple, and configuration is completely GUI driven. I’m not going to cover it in detail, there are dozens of YouTube videos and web pages out there. I’m just going to mention the stumbling blocks that I ran into.
Here is the VirtualBox user interface:
I’ve created one Ubuntu virtual machine and configured it with a 20GB HD, 20MB of video memory with 3D acceleration [2D not supported except for Windows] and a CD/ROM. Beware. My first mistake was to configure a Sata-CD/Rom. After the system would not boot, I went back and tried an IDE CD-ROM and it came right up. So Sata CD/ROMs aren’t supported for booting. Strange.
To get Ubuntu going, an ISO file is “mounted” into a virtual CD-ROM and the guest system is booted. Then you install Ubuntu as you would from the “live” CD. The installation is very quick since the CD/ROM is running at hard drive speeds rather than at CD/ROM speeds. Ubuntu 11.04 installs very quickly.
Once you have done this, you can install the Guest enhancements. These are available in the Ubuntu package manager, but probably the best way to do this is to use the Device menu of the VirtualBox interface. When the documentation mentioned this, it didn’t make sense. Look at the top of the screen for the Device menu and pull it down:
At the bottom of the left menu you can see the “Install Guest Additions…”. This causes a virtual CD/ROM, which is not a separate download but which comes with VirtualBox, to be mounted on your Ubuntu system. It should show up on the top left of your desktop. An AutoRun prompt like this should appear:
Just choose the default of “Open Autorun Prompt” and follow the instructions to get the latest guest additions. You will need to “reboot” your guest when you are done.
At this point, Shared Folders, Copy/Paste between Host and Guest and other features should work properly. In System >> Preferences >> Monitors you can set the monitor size now:
And you can also drag the window to resize it.
Tweak Your Ubuntu
One of the first things I always do to an Ubuntu system is Tweak it. It drives me nuts to have the window control buttons on the left. If you are a Mac user I’m sure that’s fine, but I keep reaching for the wrong side of the window. Install and run Tweak on your new Ubuntu system and then under the Window Manager settings, put the buttons on the right if you want to. With Ubuntu 11.04, this setting is saved as part of the Theme, and if you chose a new theme in System >> Preferences >> Appearance a popup will ask you if you want to keep your button settings rather than resetting them to follow the theme.
To Unify or Not
Unify is the new user interface for Ubuntu 11.04. Well I’m sure some folks may like it, but I like the “Classic” look introduced in version 9.0x. To get back to an interface that looks more like Windows, you can log out and then choose the window manager style from the login menu. Click on your name and then choose the window manager style from the menu at the bottom of the login screen before you type your password.
Trouble in Theme-dom
I had trouble with my theme showing up as flat rather than rounded. The Ambiance theme looked more like Windows XP or earlier. After a lot of messing around, I found that if you choose “Ubuntu Classic (No Effects)” you get a rounded theme. Now I’m using “Ubuntu Classic” apparently with effects, and it looks fine. Not sure what happened. But No Effects cleaned it up to look rounded and pretty.
Now that guest additions are installed on your Ubuntu guest, you can use Shared Folders. But they aren’t as “Automatic” as you might like. Find the shared folders dialog under the devices menu at the top or by right click on the “shared folders” icon at the bottom of the guest screen on the right. Auto-mount does work, but the mounted files don’t show up on your desktop as you expect. Instead, they show up under /media. I put a link on the guest desktop to /media so I can get to my shared folders easily. Use a file explorer to navigate to /media under File System, and then CTRL+LeftMouse drag the media folder to your desktop. That will create a lnk to /media. You need to reboot the guest after any changes to shared folders so the changes show up on the Guest system. Shared folders don’t clean up. If you remove a shared folder from the shared folders dialog, it continues to show up as an empty folder under /media forever. The folders are mount points apparently and are owned by root so they can’t be deleted by you without doing something special. They shouldn’t cause any problems however, so just leave them alone.
By using a Full access [ uncheck read-only ] shared folder, you can get your work out of the guest machine and back into the host machine. Remember to reboot the guest after any changes to the shared folder list, and just dismiss all those pesky popups that talk about some error or other.
Beware of USB Devices
I tried to plug in a USB thumb drive and then make it available to the guest system using the USB menu of the interface. That hung both the guest VM and the VirtualBox control panel. I had to reboot the Windows host. So unless you are feeling brave, I’d avoid USB devices. Maybe they work, but a Thumb Drive hung my system. Maybe a thumb drive will work fine as a shared folder.
The virtual machine is given a unique MAC address and VirtualBox runs a NAT router in software to isolate the guest from the rest of your network. I imagine that the VM can be put on your windows network with Samba, but that’s a lot of trouble. I’m just going to stick with shared folders rather than going to the trouble of setting up windows file sharing.
Browsing, downloading and system updates work through the network with no configuration at all. VirtualBox NAT apparently has DHCP to give the guest an address so that it works with no configuration or trouble at all. The NAT is on a 10.x.x.x network. My home network is 192.168.x.x, as most are, so there are no address conflicts.
I’m doing Qt development on my Guest system, so I’ve installed Qt Creator and the SeaPine SCM source control client. They both came up without any issues.
Ubuntu on Ubuntu
My next project will be to run Ubuntu on Ubuntu to provide an isolated testing system. I’ve decided to upgrade my host system to 11.04 first however.
VirtualBox is Great
I recommend VirtualBox as a VM solution for users – for safe banking or surfing – and for developers. Easy to install and trouble free. Sun / Oracle have a great product and the price can’t be beat.