- Login to the Ubuntu guest as a sudo user and install the packages required for building external kernel modules:
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)
- From the virtual machine menu, click Devices -> “Insert Guest Additions CD Image”
- Open the Ubuntu guest terminal, create a new directory as the mount point for the CD drive and mount the ISO file:
sudo mkdir -p /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
- Navigate to the directory and run the VBoxLinuxAdditions.run script to install the Guest Additions. The --nox11 option will tell the installer not to spawn an xterm window:
cd /mnt/cdrom
sudo sh ./VBoxLinuxAdditions.run --nox11
- Reboot the Ubuntu guest for changes to take effect:
sudo shutdown -r now