Monday, February 20, 2012

Installing Guest additions in VirtualBox; Windows 7 host.

In order to share folders, clipboard and other things you must install the Virtualbox Guest Additions. The iso file that you need to mount in your CentOS guest is located in the VirtualBox installation directory and is named VBoxGuestAdditions.iso.

EDIT: I just realized that the option to mount the guest additions iso file is right in the menu! From the guest window, click on Devices > CD/DVD Devices > Install Guest Additions
If you don't see it there, you are probably using an older version of Virtualbox and should follow the directions below.

From the guest window, click on Devices > CD/DVD Devices > Choose a virtual CD/DVD disc file...
You might see the file name in the list already, but if not, you need to navigate to the installation directory of Virtualbox itself (C:\Program Files\Oracle\Virtualbox by default) and select the iso file.




Before you jump into installing the Virtualbox Guest Additions, you should prepare your system as suggested by the Virtualbox documentation. To do this, run the following command:

# yum -y update && yum -y install gcc make kernel-devel
# reboot


Now from the command line in the CentOS guest mount the image as a virtual device:
# mount -t iso9660 /dev/cdrom /mnt

After this, run the set up:
# cd /mnt
# sh ./VBoxLinuxAdditions.run

Now you are supposed to install a package named dkms, but this is not available by default in the CentOS yum repo. Whenever you run updates on the kernel in your CentOS guest, you will need to run this command:

/etc/init.d/vboxadd setup

2 comments:

  1. yum install make was missing on my system (centos6.3 server)

    ReplyDelete
    Replies
    1. That's odd...
      I'm not sure if you meant that GNU make was missing and you had to install it, or you couldn't install it through yum. By default make isn't installed on servers unless you choose to install the development tools group of packages at installation. To get most of what you would require to compile software, you can do yum groupinstall "Development Tools".

      If it was missing from your yum repo, you could always just do yum clean all and try again. It's in there for certain.

      Delete