Site icon CentLinux

How to install VirtualBox on Ubuntu Server 18

Share on Social Media

Learn how to install VirtualBox on Ubuntu Server 18 with this step-by-step guide. Follow easy instructions to set up your virtualization environment quickly and efficiently. #centlinux #ubuntu #virtualbox

What is VirtualBox?

VirtualBox is a free and open-source hosted hypervisor for x86 virtualization, developed by Oracle Corporation. VirtualBox was created by Innotek, it was acquired by Sun Microsystems in 2008, which was in turn acquired by Oracle in 2010.

VirtualBox can be installed on Windows, macOS, Linux, Solaris and OpenSolaris. There are also ports to FreeBSD and Genode. It supports the creation and management of guest virtual machines running Windows, Linux, BSD, OS/2, Solaris, Haiku, and OSx86, as well as limited virtualization of macOS guests on Apple hardware. For some guest operating systems, a “Guest Additions” package of device drivers and system applications is available, which typically improves performance, especially that of graphics.

The core package is, since version 4 in December 2010, free software under GNU General Public License version 2 (GPLv2). The separate “VirtualBox Oracle VM VirtualBox extension pack” providing support for USB 2.0 and 3.0 devices, Remote Desktop Protocol (RDP), disk encryption, NVMe and Preboot Execution Environment (PXE) boot is under a proprietary license, called Personal Use and Evaluation License (PUEL), which permits use of the software for personal use, educational use, or evaluation, free of charge. Since VirtualBox version 5.1.30 Oracle defines personal use as the installation of the software on a single host computer for non-commercial purposes. (Source: Wikipedia)

If you are new to Ubuntu then, there is a good reference book for you, that is Ubuntu Linux Toolbox (PAID LINK) by Wiley. It contains 1000+ commands for Ubuntu and Debian power users.

Recommended Online Training: Mastering VirtualBox: From Beginner to Expert!!

VirtualBox Alternatives

If you’re considering alternatives to VirtualBox for your virtualization needs, there are several options available that cater to different use cases and preferences. Here are some popular VirtualBox alternatives:

VMware Workstation Player/Pro

KVM (Kernel-based Virtual Machine)

Hyper-V

Parallels Desktop

Proxmox VE

QEMU

Xen

Each of these alternatives has its own strengths and ideal use cases, so the best choice will depend on your specific requirements and environment.

Ubuntu Server Specification

We are using a minimal Ubuntu Server virtual machine with following specification.

Update Ubuntu Software Packages

Connect with virtualbox-01.centlinux.com as an admin user by using a ssh tool.

Execute following Linux command to check for updated software packages.

ahmer@ubuntu-server:~$ sudo apt update
Hit:1 http://pk.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://pk.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://pk.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://pk.archive.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
10 packages can be upgraded. Run 'apt list --upgradable' to see them.

Install all available software updates using apt command.

ahmer@ubuntu-server:~$ sudo apt -y upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libdumbnet1
Use 'sudo apt autoremove' to remove it.
The following packages will be upgraded:
  bsdutils fdisk libblkid1 libfdisk1 libmount1 libsmartcols1 libuuid1 mount
  util-linux uuid-runtime
10 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,740 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 bsdutils amd64 1:2.31.1-0.4ubuntu3.6 [60.3 kB]
Get:2 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libuuid1 amd64 2.31.1-0.4ubuntu3.6 [20.1 kB]
Get:3 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libblkid1 amd64 2.31.1-0.4ubuntu3.6 [124 kB]
Get:4 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libfdisk1 amd64 2.31.1-0.4ubuntu3.6 [164 kB]
Get:5 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmount1 amd64 2.31.1-0.4ubuntu3.6 [136 kB]
Get:6 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsmartcols1 amd64 2.31.1-0.4ubuntu3.6 [83.7 kB]
Get:7 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 fdisk amd64 2.31.1-0.4ubuntu3.6 [108 kB]
Get:8 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 util-linux amd64 2.31.1-0.4ubuntu3.6 [903 kB]
Get:9 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 mount amd64 2.31.1-0.4ubuntu3.6 [107 kB]
Get:10 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 uuid-runtime amd64 2.31.1-0.4ubuntu3.6 [34.8 kB]
Fetched 1,740 kB in 4s (398 kB/s)
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../bsdutils_1%3a2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking bsdutils (1:2.31.1-0.4ubuntu3.6) over (1:2.31.1-0.4ubuntu3.5) ...
Setting up bsdutils (1:2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../libuuid1_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking libuuid1:amd64 (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up libuuid1:amd64 (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../libblkid1_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking libblkid1:amd64 (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up libblkid1:amd64 (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../libfdisk1_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking libfdisk1:amd64 (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up libfdisk1:amd64 (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../libmount1_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking libmount1:amd64 (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up libmount1:amd64 (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../libsmartcols1_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking libsmartcols1:amd64 (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up libsmartcols1:amd64 (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../fdisk_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking fdisk (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up fdisk (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../util-linux_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking util-linux (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up util-linux (2.31.1-0.4ubuntu3.6) ...
(Reading database ... 102529 files and directories currently installed.)
Preparing to unpack .../mount_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking mount (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Preparing to unpack .../uuid-runtime_2.31.1-0.4ubuntu3.6_amd64.deb ...
Unpacking uuid-runtime (2.31.1-0.4ubuntu3.6) over (2.31.1-0.4ubuntu3.5) ...
Setting up mount (2.31.1-0.4ubuntu3.6) ...
Setting up uuid-runtime (2.31.1-0.4ubuntu3.6) ...
Processing triggers for systemd (237-3ubuntu10.39) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

Add VirtualBox APT Repository

VirtualBox 5.2 is available in default APT repositories. You can check this by executing following command at Linux bash prompt.

ahmer@ubuntu-server:~$ apt search virtualbox | grep -B2 "base binaries"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

virtualbox/bionic-updates 5.2.34-dfsg-0~ubuntu18.04.1 amd64
  x86 virtualization solution - base binaries

If you want to install VirtualBox on Ubuntu then you can easily install it using apt command.

However, if you wish to install the latest version of VirtualBox, then you are required to add VirtualBox official APT repository in your Linux server, and then you can install VirtualBox thereon.

Before adding VirtualBox APT repository, you should add the GPG key of this repository in your Ubuntu server (As mentioned in VirtualBox documentation).

ahmer@ubuntu-server:~$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
OK
ahmer@ubuntu-server:~$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
OK

Edit APT repository’s sources list.

ahmer@ubuntu-server:~$ sudo vi /etc/apt/sources.list

And add following directive therein.

# VirtualBox APT Repository
deb https://download.virtualbox.org/virtualbox/debian bionic contrib

Run following command to fetch information from VirtualBox repository.

ahmer@ubuntu-server:~$ sudo apt update
Hit:1 http://pk.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://pk.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 https://download.virtualbox.org/virtualbox/debian bionic InRelease [4,432 B]
Get:4 http://pk.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://pk.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:6 http://pk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [892 kB]
Get:7 https://download.virtualbox.org/virtualbox/debian bionic/contrib amd64 Packages [1,864 B]
Get:8 http://pk.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,060 kB]
Fetched 2,210 kB in 7s (299 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

VirtualBox APT repository has been added in Linux Server.

Install VirtualBox on Ubuntu Server

Oracle VirtualBox 6.1 is the latest version at the time of this writing. Now, you can easily install VirtualBox on Ubuntu by using apt command.

ahmer@ubuntu-server:~$ sudo apt install -y virtualbox-6.1
...
Setting up libqt5svg5:amd64 (5.9.5-0ubuntu1) ...
Setting up virtualbox-6.1 (6.1.4-136177~Ubuntu~bionic) ...
Adding group `vboxusers' (GID 113) ...
Done.
Setting up libwww-perl (6.31-1ubuntu0.1) ...
Setting up adwaita-icon-theme (3.28.0-1ubuntu1) ...
update-alternatives: using /usr/share/icons/Adwaita/cursor.theme to provide /usr/share/icons/default/index.theme (x-cursor-theme) in auto mode
Setting up liblwp-protocol-https-perl (6.07-2) ...
Setting up humanity-icon-theme (0.6.15) ...
Setting up libxml-parser-perl (2.44-2build3) ...
Setting up libxml-twig-perl (1:3.50-1) ...
Setting up ubuntu-mono (16.10+18.04.20181005-0ubuntu1) ...
Setting up libnet-dbus-perl (1.1.0-4build2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for udev (237-3ubuntu10.39) ...
Processing triggers for systemd (237-3ubuntu10.39) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.6) ...
Setting up glib-networking:amd64 (2.56.0-1) ...
Setting up libsoup2.4-1:amd64 (2.62.1-1ubuntu0.4) ...
Setting up libsoup-gnome2.4-1:amd64 (2.62.1-1ubuntu0.4) ...
Setting up librest-0.7-0:amd64 (0.8.0-2) ...
Setting up libgtk-3-0:amd64 (3.22.30-1ubuntu4) ...
Setting up libgtk-3-bin (3.22.30-1ubuntu4) ...
Setting up qt5-gtk-platformtheme:amd64 (5.9.5+dfsg-0ubuntu2.5) ...
Setting up notification-daemon (3.20.0-3) ...
Setting up libgirara-gtk3-3:amd64 (0.2.8-2) ...
Setting up zathura-pdf-poppler (0.2.8-1) ...
Setting up zathura (0.3.8-1) ...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.36.11-2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

Oracle VirtualBox has been installed successfully.

If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.

Final Thoughts

Installing VirtualBox on Ubuntu Server 18 can be a straightforward process if you follow the right steps. Whether you are setting up a test environment or deploying virtual machines for production, VirtualBox offers a robust solution for your virtualization needs.

If you need further assistance or have any specific requirements, I offer professional installation and configuration services. Feel free to reach out to me on Fiverr for personalized support and expert guidance. Let’s get your virtualization environment up and running smoothly!

Exit mobile version