How to Install VirtualBox Guest Additions

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

£18.99    £9.50
by Alfonso V. Romero | April 2010 | Beginner's Guides Linux Servers Open Source

In this article by Alfonso V. Romero, author of VirtualBox 3.1: Beginner's Guide, you shall learn what the Guest Additions are and how to install them on Windows, Linux, and Open Solaris virtual machines.

Introducing Guest Additions

Ok, you have been playing with a couple of virtual machines by now, and I know it feels great to be capable of running two different operating systems on the same machine, but as I said at the beginning of this article, what's the use if you can't share information between your host and guest systems, or if you can't maximize your guest screen? Well, that's what Guest Additions are for.

With the Guest Additions installed in a virtual machine, you'll be able to enjoy all of these:

  • Full keyboard and mouse integration between your host and your guest operating systems: This means you won't need to use the capture/uncapture feature anymore!
  • Enhanced video support in your guest virtual machine: You will be able to use 3D and 2D video acceleration features, and if you resize your virtual machine's screen, its video resolution will adjust automatically. Say hello to full screen!
  • Better time synchronization between host and guest: A virtual machine doesn't know it's running inside another computer, so it expects to have 100% of the CPU and all the other resources without any interference. Since the host computer needs to use those resources too, sometimes it can get messy, especially if both host and guest are running several applications at the same time, as would be the case in most situations. But don't worry about it! Guest Additions re-synchronize your virtual machine's time regularly to avoid any serious problems.
  • Shared folders: This is one of my favorite Guest Addition features! You can designate one or more folders to share files easily between your host and your guest, as if they were network shares.
  • Seamless windows: This is another amazing feature that lets you use any application in your guest as if you were running it directly from your host PC. For example, if you have a Linux host and a Windows virtual machine, you'll be able to use MS Word or MS Excel as if you were running it directly from your Linux machine!
  • Shared clipboard: This is a feature I couldn't live without because it lets you copy and paste information between your host and guest applications seamlessly.
  • Automated Windows guest logons: The Guest Additions for Windows provide modules to automate the logon process in a Windows virtual machine.

Now that I've shown you that life isn't worth living without the Guest Additions installed in your virtual machines, let's see how to install them on Windows, Linux, and Solaris hosts.

Installing Guest Additions for Windows

"Hmmm… I still can't see how you plan to get everyone in this office using VirtualBox… you can't even use that darned virtual machine in full screen!" your boss says with a mocking tone of voice. "Well boss, if you stick with me during these article's exercises, you'll get your two cents worth!" you respond back to him, feeling like the new kid in town…

Time for action – installing Guest Additions on a Windows XP virtual machine

In this exercise, I'll show you how to install Guest Additions on your Windows XP virtual machine so that your boss can stop whining about not being able to use the Windows VM as a real PC...

  1. Open VirtualBox, and start your WinXP virtual machine. Press F8 when Windows XP is booting to enter the Windows Advanced Options Menu, select the Safe Mode option, and press Enter to continue:
  2. VirtualBox 3.1: Beginner's Guide
  3. Wait for Windows XP to boot, and then login with your administrator account. The Windows is running in safe mode dialog will show up.
  4. Click on Yes to continue, and wait for Windows to finish booting up. Then select the Devices option from VirtualBox's menu bar, and click on the Install Guest Additions option:
  5. VirtualBox 3.1: Beginner's Guide

  6. VirtualBox will mount the Guest Additions ISO file on your virtual machine's CD/DVD-ROM drive, and the Guest Additions installer will start automatically:
  7. VirtualBox 3.1: Beginner's Guide

  8. Click on Next to continue. The License Agreement dialog will appear next. Click on the I Agree button to accept the agreement and continue.
  9. Leave the default destination folder on the Choose Install Location dialog, and click on Next to continue.
  10. The Choose Components dialog will appear next. Select the Direct 3D Support option to enable it, and click on Install to continue:
  11. VirtualBox 3.1: Beginner's Guide

  12. Guest Additions will begin to install in your virtual machine.
  13. The next dialog will inform you that the Guest Additions setup program replaced some Windows system files, and if you receive a warning dialog from the Windows File Protection mechanism, you need to click on the Cancel button of that warning dialog to avoid restoring the original files.
  14. Click on OK to continue. The setup program will ask if you want to reboot your virtual machine to complete the installation process. Make sure the Reboot now option is enabled, and click on Finish to continue.
  15. Your WinXP virtual machine will reboot automatically, and once it has finished booting up, a VirtualBox - Information dialog will appear, to tell you that your guest operating system now supports mouse pointer integration.
  16. Enable the Do not show this message again, and click on the OK button to continue. Now you'll be able to move your mouse freely between your virtual machine's area and your host machine's area! You'll also be able to resize your virtual machine's screen, and it will adjust automatically!

What just happened?

Hey, it was pretty simple and neat, huh? Now you can start to get the real juice out of your Windows virtual machines! And your boss will never complain again about your wonderful idea of virtualizing your office environment with VirtualBox!

The Guest Additions installation process on Windows virtual machines is a little bit more complicated than its Linux or OpenSolaris counterparts due to the fact that Windows has a file protection mechanism that interferes with some system files VirtualBox needs to replace. By using 'Safe Mode', VirtualBox can override the file protection mechanism, and the Guest Additions software can be installed successfully. But if you don't want or need 3D guest support, you can install Guest Additions in Windows, normal mode.

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

Installing Guest Additions for Linux

Ok, in the previous section, you saw how to install Guest Additions on a Windows virtual machine. Now go and show your boss the real benefit of using a Linux virtual machine on a Windows XP host PC!

Time for action – installing Guest Additions on Linux Ubuntu

In this exercise, I'll show you how to install Guest Additions on your Linux Ubuntu virtual machine. I'm using a Windows XP host, but it doesn't matter if you're using Windows, Linux, or Solaris as the host operating system because the process to install Guest Additions on a Linux virtual machine is nearly the same!

  1. Open VirtualBox, and start your UbuntuVB virtual machine. After logging into Ubuntu with your user account, open a terminal window, and type sudo apt-get install dkms, followed by Enter. Then follow the instructions on screen to install the DKMS package. Once installed, close the terminal window.
  2. Select Devices | Install Guest Additions from the VirtualBox menu:
  3. VirtualBox 3.1: Beginner's Guide

  4. VirtualBox will mount the Guest Additions ISO file on your virtual machine's CD/DVD-ROM drive, and the VBOXADDITIONS icon will appear on your desktop.
  5. Now open a terminal window, and type cd /media/cdrom followed by Enter to change to the CD-ROM directory containing the Guest Additions. Then type sudo sh ./VBoxLinuxAdditions-x86.run, and press Enter to start installing the VirtualBox Guest Additions on your virtual machine. When finished, the setup program will ask you to restart your Ubuntu VM.

    If you're running a 64-bit Linux guest, replace VBoxLinuxAdditions-x86.run with VBoxLinuxAdditions-amd64.run.

  6. Close the terminal window, restart your virtual machine, and wait for Ubuntu to boot up. Once is has finished booting up, a VirtualBox - Information dialog will appear to tell you that your guest operating system now supports mouse pointer integration.
  7. Enable the Do not show this message again, and click on the OK button to continue. Now you'll be able to move your mouse freely between your virtual machine's area and your host machine's area! You'll also be able to resize your virtual machine's screen, and it will adjust automatically!

What just happened?

Ok, that was pretty quick, right? I bet you're wondering why you waited for so long to try out Linux, despite the good things some of your 'geeky' friends kept telling you about! Well my friend, now's the time to vindicate yourself by exploring the fantastic world of VirtualBox and Linux virtual machines!

As you may have noticed by now, I'm using Ubuntu on every exercise related to Linux. I've used several Linux distributions during the last 10 years or so, but I decided to stick with Ubuntu for this article's exercises because of the great friendliness it offers to first-time users. If you've never used Linux before, Ubuntu is (in my humble opinion) the best way to enter the Linux world.

Now let's see some tiny details before advancing to the next exercise. In step 1 of the previous exercise, we used the sudo apt-get install dkms command to install the dkms package on your Ubuntu virtual machine. Since I don't want to bore you to death with all the details involved with this package, let's just say that dkms stands for Dynamic Kernel Module Support, and this tiny little piece of software takes care of maintaining the Linux so that your virtual machine can operate without any problems.

If for any reason DKMS isn't available for your Linux distribution, you can still run the Guest Additions. Just be sure to execute sudo/etc/init.d/vboxdrv setup everytime you update your kernel, or re-install the Guest Additions.

What happens if you want to use Fedora, Red Hat, Slackware, or any other Linux distribution instead of Ubuntu? Well, for starters, let me tell you that, at the time of this writing, the most popular Linux distributions officially supported by VirtualBox are these:

Linux distribution

Versions

Fedora

Fedora Core 4 and later

Red Hat Enterprise Linux

3 and later

SuSE and openSUSE Linux

9 and later

Ubuntu

5.10 and later

Mandriva

2008 and later

Mandrake

10.1

Slackware

10.1

For a complete list of supported guest operating systems, visit the http://www.virtualbox.org/wiki/Guest_OSes web page.

Of course, that doesn't mean you can't use a Linux distribution not officially supported by VirtualBox. You'll just have to be careful because nobody knows if Guest Additions will work flawlessly or not.

Not all Linux distributions accept the sudo apt-get install dkms command for installing the DKMS package. For example, in Fedora you'll need to use yum install dkms, and with Mandriva you'll need to use urpmi dkms. In fact, openSUSE doesn't support DKMS, and it's a very popular distribution! For more information on how to install Guest Additions on Linux distributions without DKMS support, visit the VirtualBox official forum at http://forums.virtualbox.org/index.php.

Installing Guest Additions for OpenSolaris

That's two down, one more to go! OpenSolaris is the third operating system I'll cover in this article. This is the free open source alternative to the popular Solaris operating system, so the steps to install Guest Additions on OpenSolaris apply also to Solaris.

In the following exercise, I'll use an OpenSolaris virtual machine named OpenSolarisVB on a Windows XP host. You can download OpenSolaris from http://www.opensolaris.com/get/index.jsp, create a new virtual machine, and install OpenSolaris on it to follow the exercise.

Time for action – installing Guest Additions on OpenSolaris

Ok, you showed your boss how to virtualize two of the most popular operating systems around. If you haven't tried out OpenSolaris, this is your chance to learn about it, and if you've used it before, this is your chance to compare it with Windows and Ubuntu in a virtualized environment!

  1. Open VirtualBox, and start your OpenSolarisVB virtual machine. After logging into OpenSolaris with your administrator account, select Devices | Install Guest Additions from the VirtualBox menu:
  2. VirtualBox 3.1: Beginner's Guide

  3. VirtualBox will mount the Guest Additions ISO file on your virtual machine's CD/DVD-ROM drive. The VBOXADDITIONS icon will appear on your OpenSolaris VM desktop, along with the following dialog:
  4. VirtualBox 3.1: Beginner's Guide

  5. Click on the Run button to start installing the Guest Additions. The Installing VirtualBox Additions dialog will appear to show the progress of the installation process. Wait until the installation process finishes.
  6. Press Enter to close the Installing VirtualBox Additions window when it tells you to do so, then select System | Shutdown from the OpenSolaris menu, and click on the Restart button in the Shut down this system now? dialog to restart your virtual machine.
  7. The next time your OpenSolaris VM boots up, you'll be able to move your mouse freely between your virtual machine's area and your host machine's area! You'll also be able to resize your virtual machine's screen, and it will adjust automatically!

What just happened?

As you may have noticed, OpenSolaris looks a lot like Ubuntu Linux. That's because both operating systems use the Gnome desktop manager. You can find out more about Gnome at http://www.gnome.org/ and about OpenSolaris at http://www.opensolaris.org.

Now you have the opportunity to test Windows, Ubuntu Linux, and OpenSolaris with a single PC! And all thanks to the virtualized environment created by VirtualBox! In the following sections, you'll learn to use several Guest Additions features that will provide a closer integration between your host PC and your virtual machines.

Summary

In this article, we covered how to install the Guest Additions on Windows, Linux, and Solaris guests.


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: £18.99
Book Price: £30.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


Getting started with Audacity 1.3
Getting started with Audacity 1.3

Zabbix 1.8 Network Monitoring
Zabbix 1.8 Network Monitoring

jQuery 1.4 Reference Guide
jQuery 1.4 Reference Guide

Moodle 1.9 Theme Design: Beginner's Guide
Moodle 1.9 Theme Design: Beginner's Guide

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

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

Linux Email
Linux Email

FreePBX 2.5 Powerful Telephony Solutions
FreePBX 2.5 Powerful Telephony Solutions


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