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

git fetch vs git pull: How They Work and When to Use Each

Both git fetch and git pull talk to a remote repository, but they do very different things to your…

1 week ago

git cherry-pick Command: Apply Commits from Another Branch

Sometimes the change you need already exists, just on the wrong branch. A hotfix lands…

1 week ago

Best Email APIs for Secure Business Email: Why Developers Are Moving Beyond SMTP

Email is still one of the most important communication channels inside modern applications. Password resets,…

1 week ago

Nginx Commands in Linux: Start, Stop, Reload, Test, and Log

Nginx is a high-performance web server and reverse proxy trusted by some of the largest…

2 weeks ago

ufw Command in Linux: Manage Firewall Rules with Examples

ufw (Uncomplicated Firewall) sits on top of iptables (or nftables on newer systems) and replaces…

2 weeks ago

who Command in Linux: Show All Logged-In Users and Sessions

When you share a server with a team or investigate unexpected activity, the first question…

2 weeks ago