Installing VirtualBox on Linux

Exclusive offer: get 50% off this eBook here
VirtualBox 3.1: Beginner's Guide

VirtualBox 3.1: Beginner's Guide — Save 50%

Deploy and manage a cost-effective virtual environment using VirtualBox

$29.99    $15.00
by Alfonso V. Romero | April 2010 | Beginner's Guides Linux Servers Open Source

Packt are due to launch a new Open Source brand, into which future VirtualBox titles will be published. For more information on that launch, look here.

In this article by Alfonso V. Romero, author of VirtualBox 3.1: Beginner's Guide, you will learn to install VirtualBox on Ubuntu Linux.

Let's go and get our hands dirty with VirtualBox and Ubuntu Linux!

Time for action – downloading and Installing VirtualBox on Linux

Ok, for this exercise you'll need a copy of Ubuntu Linux already installed on your PC. I chose Ubuntu because it's one of the friendliest Linux distributi ons available, as you will see in a moment.

  1. Before installing VirtualBox, you'll need to install two additional packages on your Ubuntu system. Open a terminal window (Applications | Accessories | Terminal), and type sudo apt-get update, followed by Enter. If Ubuntu asks for your administrative password, type it, and hit Enter to continue.
  2. Once the package list is updated, type sudo apt-get install dkms, and hit Enter; then type Y and hit Enter to install the DKMS package.
  3. The other package needed before you can install VirtualBox is build-essential. This package contains all the compiling tools VirtualBox needs to build the kernel module. Type sudo apt-get install build-essential, and hit Enter. Then type Y, and hit Enter again to conti nue. Wait for the $ prompt to show up again, type exit, and hit Enter to close the terminal window. Now you can proceed to install VirtualBox.
  4. Open the Synaptic Package Manager (System | Administration | Synaptic Package Manager), and select the Settings | Repositories option in the menu bar (if Ubuntu asks for your administrative password, type it, and press Enter to continue) :
  5. VirtualBox 3.1: Beginner's Guide

  6. The Software Sources dialog will appear. Click on the Other (on earlier Ubuntu versions the name of this tab is Third-Party Software)and then on the Add+ button:
  7. VirtualBox 3.1: Beginner's Guide

  8. Another dialog box will show up. Now type deb http://download.virtualbox.org/virtualbox/debian karmic non-free on the APT line field, and click on the Add Source button:
  9. VirtualBox 3.1: Beginner's Guide

    If you're not using Ubuntu 9.10 Karmic Koala, then you'll need to change the APT line in the previous step. For example, if you're using Ubuntu 9.04 Jaunty Jackalope, replace the karmic part with jaunty. On the http://www.virtualbox.org/wiki/Linux_Downloads webpage, you'll find more information about installing VirtualBox on several Linux distributions and the APT line required for each Ubuntu distribution available.

  10. The third-party software source for VirtualBox will now show up on the list:
  11. VirtualBox 3.1: Beginner's Guide

  12. Now open a terminal window (Applications | Accessories | Terminal), and type wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc to download the Sun public key:
  13. VirtualBox 3.1: Beginner's Guide
  14. Go back to the Synaptic Manager, select the Authentication tab, and click on the Import Key File button:
  15. VirtualBox 3.1: Beginner's Guide

  16. The Import Key dialog will appear next. Select the sun_vbox.asc file you just downloaded, and click on the OK button to continue:
  17. VirtualBox 3.1: Beginner's Guide

  18. The Sun public key for VirtualBox should now appear on the list:
  19. VirtualBox 3.1: Beginner's Guide

  20. You can now delete the Sun public key file you downloaded earlier. Click on the Close button to return to the Synaptic Package Manager. If the Repositories Changed dialog shows up, select the Never show this message again checkbox, and click on Close to continue.
  21. Now click on the Synaptic Package Manager's Reload button to update your package sources with the most recent VirtualBox version:
  22. VirtualBox 3.1: Beginner's Guide

  23. Once the Synaptic Package Manager finishes updating the package sources list, click on the Origin button located at the lower-left part of the window and select the download.virtualbox.org/non-free repository from the window above this button:
  24. VirtualBox 3.1: Beginner's Guide

  25. Click on the most recent virtualbox-3.X package checkbox in the right window, and select the Mark for Installation option:
  26. VirtualBox 3.1: Beginner's Guide

    When upgrading to a newer VirtualBox version, you must first completely remove the older version. Then you'll be able to install the newest version without any hassles.

  27. The Mark additional required changes? dialog box will appear next. Click on the Mark button to mark all the additional packages required to install VirtualBox:
  28. VirtualBox 3.1: Beginner's Guide

  29. Now click on the Apply button in the Synaptic Package Manager:
  30. VirtualBox 3.1: Beginner's Guide

  31. The Apply the following changes? dialog box will appear next. Make sure the Download package files only option is deselected, and click on the Apply button to start installing the required packages, along with VirtualBox:
  32. VirtualBox 3.1: Beginner's Guide

  33. The Synaptic Package Manager will start downloading the required packages and, when finished, it will install them along with VirtualBox.
VirtualBox 3.1: Beginner's Guide Deploy and manage a cost-effective virtual environment using VirtualBox
Published: April 2010
eBook Price: $29.99
Book Price: $49.99
See more
Select your format and quantity:
  1. Eventually, the Configuring virtualbox-3.X dialog will appear:
  2. VirtualBox 3.1: Beginner's Guide

  3. Click on Forward to continue configuring VirtualBox. The configuration wizard will ask if you want to compile the vboxdrv kernel module. Make sure that option is selected, and click on Forward to continue:
  4. VirtualBox 3.1: Beginner's Guide

  5. Wait until Debconf compiles the kernel module and finishes all the configuration procedure for VirtualBox. After that, the following dialog will appear:
  6. VirtualBox 3.1: Beginner's Guide

  7. This means VirtualBox installed successfully. Click on the Close button to continue and close the Synaptic Package Manager.
  8. Open a terminal window, type sudo usermod -a -G vboxusers yourusername, and hit Enter to add your username to the vboxusers group. Don't forget to replace yourusername with your own username. Then type exit, and hit Enter again to close the terminal window.
  9. Logout from Ubuntu, and then log back in. Now you can access VirtualBox through the Ubuntu menu bar (Applications | System Tools | Sun VirtualBox):
  10. VirtualBox 3.1: Beginner's Guide

  11. After opening VirtualBox for the first time, you'll see the VirtualBox License dialog. Scroll down to the end of the agreement, and then click on the I Agree button to continue.
  12. Next you'll see the VirtualBox Registration Dialog:
  13. VirtualBox 3.1: Beginner's Guide

  14. If you already have a Sun account, just fill in your email and password, and click on the Register button to register your copy of VirtualBox. If this is the first time you're using a Sun product, select the I would like to register creating a new Sun Online account radio button, and fill in the required fields. Then click on Register. Once you register with Sun, you'll see a success dialog:
  15. VirtualBox 3.1: Beginner's Guide

  16. Now click on the OK button to go to the VirtualBox main screen:
  17. VirtualBox 3.1: Beginner's Guide
  18. You can close VirtualBox now.

What just happened?

Ok, ok… Installing VirtualBox on Linux is a little more elaborated process, but hey, I was behind you all the time, right? On Linux there are some additional things to consider when you're installing a software application like VirtualBox. I decided to show you how to use the Synaptic Package Manager because this wonderful piece of open source software takes care of all the complicated things that always come up when installing something in Linux.

On the first three steps of the previous exercise, you upgraded the Ubuntu packages list and then installed a couple of packages required by VirtualBox on a Linux installation. These packages prepare your system for building the external modules VirtualBox needs to operate virtual machines. The DKMS (Dynamic Kernel Module Support) package allows your system to build these modules dynamically, so you don't have to worry in case you upgrade your Ubuntu system. The build-essential package contains the gcc compiler and some other tools required to compile and build the kernel modules. The Synaptic Package Manager uses repositories scattered throughout Internet. To install VirtualBox, we had to add a specific repository called download.virtualbox.org/main because the standard Ubuntu installation only includes the virtualbox-ose package, the OSE (Open Source) version of VirtualBox. In this article we're going to work with the PUEL (Personal Use and Evaluation License) version of VirtualBox because it's free for personal/academic use or for product evaluation.

Basically, the PUEL version of VirtualBox has some features that aren't included in the OSE version:

  • USB support: You can insert USB devices on your host PC and use them in your virtual machines.
  • RDP (Remote Display Protocol) server: The PUEL version of VirtualBox includes a complete RDP server, so you can connect to remote virtual machines from any RDP compatible client.
  • USB over RDP: This means a virtual machine can access the USB devices connected to the remote computer on which the RDP client is running.

Finally, we also have to add the Sun public key because Synaptic won't be able to access the VirtualBox PUEL repository otherwise. After that, you just need to select the desired VirtualBox version, and Synaptic will take care of the rest for you.

Once you've installed VirtualBox on Linux, the process for creating and using virtual machines will be the same on any platform.

Have a go hero – experimenting with VirtualBox on Linux

If you have the ability and resources, would be a great idea to try VirtualBox on other Linux distros, but you need to make an extra effort because not every distribution uses the Synaptic Package Manager. But the VirtualBox website has some basic information on how to install VirtualBox on several Linux distros such as Debian, Fedora, Red Hat, or SuSE. The website provides several specific packages for some of the most popular Linux distributions and one general package for the rest of the Linux distros available.

Oh, and you can also start to browse around VirtualBox's user interface. Go on and experiment all you can and try to create a virtual machine by yourself!

Summary

This article was a hands-on introduction to VirtualBox, the best virtualization software out there!

Specifically, we covered, how to install VirtualBox on Linux environments.


If you have read this article you may be interested to view :

VirtualBox 3.1: Beginner's Guide Deploy and manage a cost-effective virtual environment using VirtualBox
Published: April 2010
eBook Price: $29.99
Book Price: $49.99
See more
Select your format and quantity:

About the Author :


Alfonso V. Romero

Alfonso Romero is a freelance computer consultant and translator from Mexico. He's been working with Linux and open source software since 1999. He started operating his first web server (Apache) from a PC at home, offering free hosting services to experiment with Postfix, Squirrel Mail, MySQL, Apache, Tomcat, and Virtual Hosting. Since then, he's been working as a computer consultant for several clients in Mexico – writing Java, C++, and Web applications. Since 2000, he has worked for Pearson Education in Mexico as a computer books freelance translator and consultant. His latest book translations are the Spanish versions of Java How to Program, Seventh Edition, from Deitel & Deitel, and C++ How to Program, Sixth Edition, also from Deitel & Deitel. Al enjoys writing tutorials and teaching about Java, C++, PHP, the Apache Web server, Tomcat, MySQL, Web applications like Apache Roller, and all of the wonderful open source applications used today, and when he's not experimenting with new trends in Open Source applications, he enjoys playing his electric guitar.

Books From Packt


Zabbix 1.8 Network Monitoring
Zabbix 1.8 Network Monitoring

iReport 3.7
iReport 3.7

Microsoft Silverlight 4 Business Application Development: Beginner’s Guide
Microsoft Silverlight 4 Business Application Development: Beginner’s Guide

OpenX Ad Server: Beginner's Guide
OpenX Ad Server: Beginner's Guide

MediaWiki 1.1 Beginner's Guide
MediaWiki 1.1 Beginner's Guide

Beginning OpenVPN 2.0.9
Beginning OpenVPN 2.0.9

SketchUp 7.1 for Architectural Visualization: Beginner's Guide
SketchUp 7.1 for Architectural Visualization: Beginner's Guide

FreePBX 2.5 Powerful Telephony Solutions
FreePBX 2.5 Powerful Telephony Solutions


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
G
Q
n
5
G
H
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software