Reboot to Linux and Discover Freedom

Virtualbox – How to Install and Configure

vbox-fi

Using VirtualBox is a safe way to try or use other operating systems, whether they are stable or unstable as a Guest OS.  For example I run Windows 10 and other Linux Distros as a guest in a virtualbox.  This tutorial shows how to install and configure Virtualbox on Ubuntu 16.04 and elementary OS.

More information

There are several ways to install Virtualbox in Ubuntu or elementary OS but these instructions from the official repository are for those who want to receive future updates via Software Updater.

vbox


Install Virtualbox

Run the commands below one by one in terminal

sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" >> /etc/apt/sources.list.d/virtualbox.list'
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
sudo apt update
sudo apt install virtualbox-5.1

Add yourself to the vbox users group using your own user name

sudo gpasswd -a [your username here] vboxusers

example:  sudo gpasswd -a stephen vboxusers


Enable File Sharing between host and Guest OS

  • Highlight your guest machine and navigate to settings > shared folders
  • In the Folder Path field, select a folder on your host machine.
  • Give it the name host_share
  • Check Auto-mount to auto-mount the shared folder when the guest OS boots up. Click the OK button.
  • Now start the Linux guest machine.
  • In /media/ directory of the Linux guest, you will find a new directory called sf_host_share (or the name you gave it in step 3).
  • By default, only root and members of the vboxsf group have read and write access to this directory. So you need to add your username to vboxsf group.

In the terminal type

sudo gpasswd -a [your username here] vboxsf
  • Log out of the current session and log back in.
  • Now you can access the /media/sf_host_share directory.
  • Now create a soft link that points to /media/sf_host_share.
ln -s /media/sf_host_share /home/[your username here] host_share

Enable copy and paste between host and guest

To achieve this, open the settings window of your guest machine.

  • Go to General > Advanced.
  • Change the value of Shared Clipboard to Bidirectional.
  • Then click OK.

Install Guest Additions on Ubuntu based Guests

Note These instructions are only suitable for ubuntu based distro guests like elementary OS. For others (e.g. Arch, Fedora, OpenSuse etc) please refer to their relevant wiki page or forums.

Start the guest OS then open the terminal and update the guest OS software using the following command.

sudo apt update && sudo apt upgrade && sudo apt dist-upgrade

Reboot the guest OS with…

sudo reboot

Install required packages for building kernel modules.

sudo apt install build-essential module-assistant dkms

Now prepare the guest OS to build kernel module.

sudo m-a prepare

From the VirtualBox menu, select Devices > Insert Guest Additions CD image

Click Download when asked to do so

Note: as your host machine is elementary OS the guest additions disk image will be downloaded to strong>~/.config/VirtualBox/ directory.

Once downloaded, click Insert button

On the Guest OS a pop-up will appear asking if you would like to run it.

Click the Run button.


Enable 3D Hardware Acceleration

  • Close the Guest OS but keep it highlighted then open virtualbox settings.
  • Click Display on the left pane.
  • In the Screen tab, use the slider and allocate 128MB video memory
  • Check the Enable 3D Acceleration option
  • Now Save your settings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: