How To

Install VirtualBox on Ubuntu 18.04 from the Oracle Repository

VirtualBox is a free, open-source, cross-platform virtualization application maintained by Oracle. It lets you run multiple guest operating systems simultaneously on a single machine, each in its own isolated virtual environment. Common uses include testing software on different operating systems, running Windows applications on Ubuntu, setting up sandboxed development environments, and building server configurations that mirror production without risk to your host machine.

This guide covers how to install VirtualBox on Ubuntu 18.04 using two methods: the Oracle repository, which always provides the latest release, and the Ubuntu multiverse repository, which is simpler but may lag by a version. The same steps apply to Ubuntu 16.04, Linux Mint, and Elementary OS.

<strong>Prerequisite:</strong>&nbsp;You need sudo access.

Install VirtualBox on Ubuntu: Add the Oracle Repository

The Oracle repository gives you the most current VirtualBox release. At the time of writing, the latest stable version is VirtualBox 6.0.

Import the Oracle GPG keys. VirtualBox uses two separate signing keys — both must be imported:

bashwget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

Both commands print OK to confirm successful import. Packages from the repository will be trusted by apt once both keys are in place.

Add the VirtualBox repository:

bashsudo add-apt-repository "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"

The $(lsb_release -cs) part detects your Ubuntu codename automatically, for example bionic for Ubuntu 18.04.

Install VirtualBox:

bashsudo apt updatesudo apt install virtualbox-6.0

Install the VirtualBox Extension Pack

The Extension Pack adds features that are not included in the base VirtualBox package: virtual USB 2.0 and 3.0 device support, Remote Desktop Protocol (RDP), and virtual disk image encryption. Without it, USB devices plugged into the host machine are not accessible inside the VM, and RDP-based remote management is not available.

Download the Extension Pack that matches your VirtualBox version exactly:

bashwget https://download.virtualbox.org/virtualbox/6.0.0/Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack

Install it with VBoxManage:

bashsudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack

The Oracle license is displayed. Type y and press Enter to accept. The Extension Pack installs and confirms success with a 100% progress bar.

Install VirtualBox from Ubuntu Repositories or Launch the Application

Ubuntu repository method. If you do not need the absolute latest version, the Ubuntu multiverse repository is a simpler one-command install. It also includes the Extension Pack automatically:

bashsudo apt updatesudo apt install virtualbox virtualbox-ext-pack

Launch VirtualBox. Open it from the Activities menu by searching for “Oracle VM VirtualBox,” or start it from the terminal:

bashvirtualbox

The VirtualBox Manager window opens. Click New to create a virtual machine. You configure RAM, virtual CPUs, video memory, network adapters, and storage during setup. VirtualBox supports both dynamically-allocated disk images, which grow as data is written, and fixed-size images, which allocate all space up front for better performance.

VirtualBox is now installed on your Ubuntu 18.04 machine. Visit the VirtualBox documentation to learn how to configure shared folders, manage snapshots, and set up host-only networks. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

pgrep Command in Linux: Find and Filter Running Processes

The pgrep command in Linux finds the PIDs of running processes based on a name or other…

18 hours ago

unlink Command in Linux: Remove a Single File or Symlink

The unlink command in Linux removes a single file by deleting its directory entry. It is a…

19 hours ago

How to Check Open Ports in Linux: nmap, netcat, and Bash

When troubleshooting a network connection or configuring a firewall, the first question is whether a…

19 hours ago

ifconfig Command in Linux: Configure Network Interfaces

The ifconfig command in Linux displays and configures network interfaces. It can assign IP addresses, bring interfaces…

20 hours ago

groupdel Command in Linux: Remove a Group and Audit Files

The groupdel command in Linux removes a group from the system. It deletes the group's entry from /etc/group and /etc/gshadow,…

2 days ago

wc Command in Linux: Count Lines, Words, Characters, and Bytes

The wc command in Linux counts lines, words, characters, and bytes in files or standard input. It…

2 days ago