How To install Oracle VirtualBox On Linux Systems

If Windows user wants to test Linux distribution, or Linux user wants to try other Linux distributions, i would advise you guys to use Oracle Virtualbox to test this because virtualization software wont harm anything on your system.

Not only virtualbox, also you can use other alternatives such as QEMU, VMware Workstation Player, etc,. I prefer virtualbox because i was using more than 4 years.

What is Virtualbox?

VirtualBox (formerly known as Sun VirtualBox, Sun xVM VirtualBox and Innotek VirtualBox) is an open source cross-platform virtualization software for x86 architecture and run on Linux, Windows & Mac.

It was initially built & developed by Innotek GmbH and it was acquired by Sun Microsystems in 2008, later it was acquired by Oracle in 2010 and currently being developed by Oracle Corporation.

It allows for other operating systems (known as Guests) to be installed and run within an existing operating system (known as the Host).

All of the features are available in Free version as well for personal use and not for commercial use.

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).

Oracle defines personal use as the installation of the software on a single host computer for non-commercial purposes.

VirtualBox is an amazing software which have lot of features compare with other virtualization software such as QEMU, VMware,etc.., and still development team hardly working on virtualbox to improve the stability.

Navigate to the following article to install Oracle Virtualbox on Arch Linux/Manjaro systems.

If you had installed virtualbox on headless server and would you like to install front end tool for easy management? I can suggest you to use phpVirtualBox or RemoteBox.

The latest version of VirtualBox 5.2.22 released on November 09, 2018 which is 22’nd update for Virtualbox 5.2 series.

How To Install VirtualBox on Debian, Ubuntu & LinuxMint Systems

Follow the below steps to install latest version of VirtualBox from the Oracle repositories on Debian, Ubuntu & Mint Systems.

[Import Oracle Public Key]
$ wget -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 -

[Add Virtualbox Repository]
$ sudo sh -c "echo 'deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list"

[Update Repository Index]
$ sudo apt-get update

[Install VirtualBox]
$ sudo apt-get install virtualbox-5.2

How To Install VirtualBox on CentOS, RHEL & Fedora Systems

Follow the below steps to install latest version of VirtualBox from the Oracle repositories on CentOS, RHEL & Fedora Systems.

[Install dependency packages]
# [yum|dnf] install dkms kernel-devel kernel-headers

[Add Virtualbox Repo to RHEL/CentOS]
# yum-config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

[Add Virtualbox Repo to Fedora]
# dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

[Install VirtualBox on CentOS & RHEL System]
# yum install virtualbox-5.2

[Install VirtualBox on Fedora System]
# dnf install virtualbox-5.2

[Finally add the user account to the vbox User Group]
# usermod -a -G vboxusers [user_name]

How To Install VirtualBox on openSUSE

Follow the below steps to install latest version of VirtualBox from the Oracle repositories on openSUSE System.

[Install dependency packages]
# zypper install dkms kernel-devel

[Add Virtualbox Repo to openSUSE Leap]
# zypper addrepo https://download.virtualbox.org/virtualbox/rpm/opensuse/virtualbox.repo

[Install VirtualBox]
# zypper install virtualbox-5.2

Rebuild VirtualBox kernel module

After installing VirtualBox, It’s necessary to rebuild kernel modules to make it work properly. Use the below commands to rebuild VirtualBox kernel module.

[For SysVinit Systems]
# /etc/init.d/vboxdrv setup

[For systemd Systems]
# /sbin/rcvboxdrv setup

Run the following command to launch VirtulBox.

# virtualbox

How to Install VirtualBox Extension

VirtualBox Extension pack ads additional future to virtualbox such as Support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot & Disk image encryption with AES algorithm.

$ cd /opt
$ sudo wget https://download.virtualbox.org/virtualbox/5.2.22/Oracle_VM_VirtualBox_Extension_Pack-5.2.22.vbox-extpack
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.22.vbox-extpack

For uninstalling virtualbox Extension pack, just follow the below procedure.

[Check virtualbox Extension pack version]
$ vboxmanage list extpacks

[Remove virtualbox Extension pack version]
$ sudo VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"

How To Check VirtualBox installed version

open VirtualBox and navigate to Help > About Virtualbox to see the installed version of virtual box on your system.
install-virtualbox-5-1-on-linux

Errors/Troubleshooting

Most of the user reported, below two error message’s, have a look @ /var/log/vbox-install.log. If, so. Follow belwo steps to troubleshoot it.

[Error]
# Can't create temporary cache file /etc/ld.so.cache~: Permission denied
ldconfig exited ungracefully

[Solution: Disable SELINUX]
# setenforce 0

[Error: KERN_DIR not detected]
# KERN_DIR

[Export kernel]
# export KERN_DIR=/usr/src/kernels/`uname -r`

Create New VM’s and refresh/learn new things…Have a great DAY..)

Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

You may also like...