Install VirtualBox Guest Additions Ubuntu 18.04

In this tutorial we are going to learn how to install the VirtualBox guest additions on Ubuntu 18.04 Virtual Machine runs on Oracle VM VirtualBox. You can use the following method on Both Ubuntu Server and Desktop Operating Systems.

Install VirtualBox Guest Additions Ubuntu 18.04

Before we install Ubuntu VirtualBox guest additions, we need to install dependency packages which include dkms, build-essential and linux-headers . Then we mount the guest additions CD image to the Ubuntu VM and run the VBoxLinuxAdditions.run file. So let's see how it is done.

Step One

Install dkms, build-essential and linux-headers on Ubuntu 18.04

Open the Ubuntu terminal and update the apt source list, then install dependency packages using apt-get install command.

sudo apt-get update
sudo apt-get install build-essential dkms linux-headers-$(uname -r)
Step Two

Insert VirtualBox Guest Additions CD Image

Now, we need to insert the guest additions CD image to our Ubuntu virtual machine running on Oracle VM VirtualBox.

Insert the guest additions CD image to Ubuntu virtual machine.

From the VirtualBox Devices menu, click on the Insert Guest Additions CD Image link as above image shows.

Step Three

Mount the Guest Additions CD Image

Using the Linux mount command, mount the Guest Additions CD Image to the /mnt directory.

sudo mount /dev/cdrom /mnt/
Step Four

Run the VBoxLinuxAdditions.run file

First, moves into the /mnt directory using the cd command.

cd /mnt/

Then, run the Linux guest Additions installation file VBoxLinuxAdditions.run.

sudo ./VBoxLinuxAdditions.run
Mount the Guest Additions CD Image and Run the VBoxLinuxAdditions.run file
Step Five

Restart the Ubuntu virtual Machine

Once the installation is finished, you need to restart your virtual machine. In Ubuntu 18.04 you can use "systemctl reboot" command from the command line to restart the system.

systemctl reboot

And that is how we install VirtualBox guest additions on Ubuntu 18.04.

The headers for the current running kernel were not found

During the installation some users get the following warning message: "The headers for the current running kernel were not found". This error occurs because you haven’t installed the dependency packages on Ubuntu 18.04.

Install dkms, build-essential and linux-headers packages described in the step one and rerun the VBoxLinuxAdditions.run script to solve the problem.

Why Install Ubuntu VirtualBox Guest Additions?

VirtualBox Guest Additions will greatly increase the performance of your Ubuntu Virtual Machine and also enable some useful features like:

  • Mouse pointer integration - Allow to Move mouse pointer between the host computer and the Ubuntu virtual machine.
  • Folder Sharing - Share Folders between the host and the virtual machine.
  • Shared Clipboard - Share clipboard between the host and virtual machine.
  • Seamless mode - Allow to run the Virtual Machine in the seamless mode.

Also the Ubuntu VirtualBox Guest Additions will correct the Screen resolution of your Ubuntu Desktop.