I’ve mentioned previously that my preferred virtualization platform is VMware Workstation. That remains true …but VirtualBox does have the distinct advantage of being free-of-charge. So unless I want to insist that my readers find AU$291.50 for VMware’s offering, it behooves me instead, from time to time, to use the virtualization platform I know we can all afford.
So here is my two-minute recipe guide to getting the latest VirtualBox product installed (for zero dollars!) on Scientific Linux 6.1. (You could always just download the relevant rpm and install it directly, but I prefer to do all my package management via yum wherever possible, so that’s the approach described here).
1. Get the gpg key
VirtualBox is supplied as a bunch of rpm packages which have been digitally signed. By checking the signature, you know no-one’s messed about with the packages before they reached you. It therefore makes sense to obtain and install the digital key needed to do that signature check. It’s easy to do, as root, at a command prompt, by issuing these two commands:
wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc rpm --import oracle_vbox.asc
2. Create the yum repository
Again as root, issue this command to create a new, blank repository file:
Now paste in these contents to the empty file:
[virtualbox] name=RHEL/CentOS-$releasever / $basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/rhel/6.0/$basearch enabled=1 gpgcheck=1 gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Save the file changes and close down gedit. Just in passing, you might note that I’ve changed this file from the version which Oracle themselves makes available on the VirtualBox website. Specifically, their baseurl uses an environment variable, called $releasever, where I have hard-coded in the number 6.0. The trouble, of course, is that if you are using the latest versions of Scientific Linux or Centos, you’ll be picking up a releasever of 6.1 or 6.2 …and no such directory exists on the VirtualBox servers. You’d need to manually check out those server’s directory structure to see if that situation changes over time.
3. Install the Software
As root once more, the following one-liner will display all the different versions of VirtualBox that are available for installation:
yum search VirtualBox
You might see this sort of output in return:
Loaded plugins: refresh-packagekit virtualbox | 951 B 00:00 virtualbox/primary | 4.4 kB 00:00 virtualbox 17/17 ============== N/S Matched: VirtualBox ============== VirtualBox-3.2.x86_64 : Oracle VM VirtualBox VirtualBox-4.0.x86_64 : Oracle VM VirtualBox VirtualBox-4.1.x86_64 : Oracle VM VirtualBox
This shows that Oracle keeps a couple of older versions of the software alive and available, should you need to use them. Most people, though, will really only need the latest version, so pick that from the list and issue an appropriate “yum install” command. In my case, given the above output, this command will do the right thing:
yum -y install VirtualBox-4.1.x86_64
It’s a 58MB download or so, and as it’s installed you might see this message appear:
Running Transaction Installing : VirtualBox-4.1-4.1.8_75467_rhel6-1.x86_64 1/1 Creating group 'vboxusers'. VM users must be member of that group!
This gives you the clue to the last stage of the installation process…
4. Assigning Group Privileges
The software installation has created a new O/S group, called vboxusers, but it won’t have made your user account a member of that group. That needs to be fixed.
From the Gnome top panel, clieck System > Administration > Users and Groups. Find your user details on the Users tab and double-click the entry. Switch to the Groups tab, scroll down and check the vboxusers group name:
Click [OK] to save the change, and you’re done, though you’ll need to log off and back on before the group membership changes take practical effect.
If you prefer doing everything at the command line, just edit /etc/group (as root, of course) and add a :your-username entry to the end of the vboxusers line, which will probably be the last line of the file. In my case, for example, the line ended up reading vboxusers:x:501:hjr -which simply means that user ‘hjr’ is now a member of the vboxusers group. (Again, it’ll take a log off and fresh log on before the new group membership actually takes effect).
Either way, you’re now done and can run the VirtualBox program successfully, with the program launcher being found in Applications > System Tools.
5. USB Support
The version of VirtualBox installed by the above procedure will be unable to access USB 2.0 devices that might be plugged into your physical host. However, this shortcoming can be fixed by installing the “Oracle/VirtualBox Extension Pack”. Download it from the VirtualBox website and then just double-click the file when the download completes. You should see the following appear:
Click the [Install] button there, agree to the license, authenticate as root and all should be done in a matter of seconds. You’re now ready to build and run fully-functional virtual machines.