Published 2024-06-11.
Time to read: 2 minutes.
VirtualBox allows you to run another operating system within your computer’s operating system. VirtualBox is available for Windows, Macintosh, Linux and other OSes. It can virtualize Windows, Linux, macOS, Solaris, and the BSD UNIX work-alikes.
I often use an Ubuntu Desktop instance in a VirtualBox VM. It is my default Ubuntu instance for general-purpose work.
This article describes how I set up Ubuntu Desktop 24.04 in a VirtualBox VM.
Terminology
- Host
- This is the OS of the physical computer on which Oracle VM VirtualBox was installed.
- Guest
- This is the OS of the physical computer on which Oracle VM VirtualBox was installed.
- Virtual machine (VM)
- This is the special environment that VirtualBox creates for your guest OS while it is running. In other words, you run your guest OS in a VM.
Installation
I installed VirtualBox and the VirtualBox Extension Pack according to these instructions.
I then installed Ubuntu Desktop 24.04 as a guest in a new VirtualBox VM. The steps are:
- Download the Ubuntu Desktop 24.04 ISO file.
- Open VirtualBox and click on the New button to create a new virtual machine.
- Name your virtual machine and select Linux as the type and Ubuntu (64-bit) as the version.
- Allocate at least 2 GB of RAM to the virtual machine; 4 GB is better.
- Choose Create a virtual hard disk now and click Create.
- Select VDI (VirtualBox Disk Image) as the hard disk file type.
VirtualBox Guest Additions
A third item needs to be installed in the guest OS, the VirtualBox Guest Additions. It is included in the VirtualBox download and provides:
- Seamless mouse support
- Shared folders
- Better video support
- Seamless windows
- Generic host/guest communication channels
- Time synchronization
- Shared clipboard
- Automated logins
For Windows, the VirtualBox Guest Additions
are installed at %ProgramFiles%\Oracle\VirtualBox\VBoxGuestAdditions.iso
.
For Mac OS X hosts, this file is provided in the VirtualBox application bundle.
Installation
Before installing the VirtualBox Guest Additions in a guest Linux instance,
you should install gcc
, make
and perl
.
Launch the virtual machine containing the guest Ubuntu image and enter the following at a shell prompt:
$ sudo apt install build-essential gcc make perl dkms
Now reboot the guest Ubuntu instance.
Each time a VirtualBox Ubuntu instance boots,
the VirtualBox Guest Additions CD-ROM image automounts at /media/$USER/VBox_GAs_7.0.18/
.
$ ls /media/$USER/VBox_GAs_7.0.18/ AUTORUN.INF runasroot.sh VBoxSolarisAdditions.pkg autorun.sh TRANS.TBL VBoxWindowsAdditions-amd64.exe cert VBoxDarwinAdditions.pkg VBoxWindowsAdditions.exe NT3x VBoxDarwinAdditionsUninstall.tool VBoxWindowsAdditions-x86.exe OS2 VBoxLinuxAdditions.run windows11-bypass.reg
To install the VirtualBox Guest Additions
in the guest Ubuntu instance, run VBoxLinuxAdditions.run
,
and then reboot, as follows:
$ sudo /media/$USER/VBox_GAs_7.0.18/VBoxLinuxAdditions.run Verifying archive integrity... 100% MD5 checksums are OK. All good. Uncompressing VirtualBox 7.0.18 Guest Additions for Linux 100% VirtualBox Guest Additions installer Removing installed version 7.0.18 of VirtualBox Guest Additions... update-initramfs: Generating /boot/initrd.img-6.8.0-35-generic Copying additional installer modules ... Installing additional modules ... VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Setting up modules VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: To build modules for other installed kernels, run VirtualBox Guest Additions: /sbin/rcvboxadd quicksetupVirtualBox Guest Additions: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 6.8.0-35-generic. update-initramfs: Generating /boot/initrd.img-6.8.0-35-generic
$ sudo reboot