How to Install VirtualBox 5.0 in Linux

To Install VirtualBox 5.0 in Linux

Installation process of VirtualBox 5.0 an open source cross platform software on RHEL/CentOS/Fedora and Debian/Ubuntu/Linux Mint will be discussed in this article.

Features

  • Para virtualization Support for Linux and Windows Guests - it helps to improve the performance of Linux guest OS.
  • Support of USB 3.0 Devices.
  • Bi-Directional Drag and Drop Support - Guests can now support " drag and drop" of content between host and guests on all host platforms.
  • Improved CPU Utilization - A set of CPU instructions to the guest OS, allowing application to use newest hardware instructions sets for better performance.
  • Disk Image Encryption - During run time, Data will be transparently encrypted on virtual hard disk images.

To Add VirtualBox Repository

If you installed any earlier version of Virtualbox, remove that before start installing latest version.

# yum remove VirtualBox-4*

Add the VirtualBox own repository to install latest VirtualBox 5.0

For RHEL/CentOS Systems

# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

For Fedora Systems

# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

To Install Dependency Packages for VirtualBox

To control and allocate physical memory for execution of guest OS, use vboxdrv kernel module and make VirtualBox fully functional. You have to update your machine first and then install some additional modules like kernel-headers, kernel-devel, DKMS and some dependency packages.

# yum update
# yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

To Install VirtualBox 5.0

Execute below command to install VirtualBox 5.0

# yum install VirtualBox-5.0

To Rebuild Kernel Modules

Using the following command, create group and user for vbox. Also search and rebuild required kernel modules. If the process fails, you will receive a warning messages. Just trace

/var/log/vbox-install.log to know the reason for the build process failure.

# /etc/init.d/vboxdrv setup

OR 

# service vboxdrv setup

Troubleshooting

If you receive any error message like KERN_DIR or if your kernel source directory not detected by build process automatically, you will set it by using the following command. Check your change kernel version with respect to your machine.

## RHEL / CentOS / Fedora ##
KERN_DIR=/usr/src/kernels/3.10.0-229.7.2.el7.x86_64

## Export KERN_DIR ##
export KERN_DIR

To install VirtualBox in Ubuntu

Install the latest version of virtual box from the official Virtualbox repository and add the key by using the following command.

user1@linuxhelp:~$ sudo sh -c ' echo " deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"  > >  /etc/apt/sources.list.d/virtualbox.list' 
[sudo] password for user1: 

user1@linuxhelp:~$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
OK

user1@linuxhelp:~$ sudo apt-get update
Get:1 http://download.virtualbox.org wily InRelease [7,138 B]
Get:2 http://download.virtualbox.org wily/contrib amd64 Packages [986 B]                                 
Get:3 http://download.virtualbox.org wily/contrib i386 Packages [985 B]                                  
Ign http://download.virtualbox.org wily/contrib Translation-en_IN   
.
.
.
Get:52 http://in.archive.ubuntu.com wily-backports/multiverse Translation-en [28 B]                      
Get:53 http://in.archive.ubuntu.com wily-backports/restricted Translation-en [28 B]                      
Get:54 http://in.archive.ubuntu.com wily-backports/universe Translation-en [1,390 B]                     
Fetched 1,798 kB in 18s (98.4 kB/s)                                                                      
Reading package lists... Done

Now update and install the VirtualBox-5.0

user1@linuxhelp:~$ sudo apt-get install virtualbox-5.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  dkms libsdl-ttf2.0-0 libsdl1.2debian
The following NEW packages will be installed:
  dkms libsdl-ttf2.0-0 libsdl1.2debian virtualbox-5.0
.
.
.
Starting VirtualBox kernel modules ...done.
Setting up dkms (2.2.0.3-2ubuntu6.1) ...
Processing triggers for libc-bin (2.21-0ubuntu4.1) ...                                  

To Start VirtualBox 5.0

Execute the following command to start it from the terminal or use launcher from menu to start it.

user1@linuxhelp:~$ virtualbox

Enter the Name, type and version for the new system to be created.

Choose the Hard disk type as per the system requirement.

The windows 7 virtual machine setup is created. You can view the details as shown below.

Once you click start the windows machine will be installed.

To Install VirtualBox Extension Pack

If you want any additional functionality like PXE, VirtualBox RDP, USB 2.0 Host Controller support and ROM with E1000 support, etc., you have to download and install the VirtualBox Extension Pack using wget command.

user1@linuxhelp:~$ wget http://download.virtualbox.org/virtualbox/5.0.0/Oracle_VM_VirtualBox_Extension_Pack-5.0.0.vbox-extpack
--2016-05-31 03:12:52--  http://download.virtualbox.org/virtualbox/5.0.0/Oracle_VM_VirtualBox_Extension_Pack-5.0.0.vbox-extpack
Resolving download.virtualbox.org (download.virtualbox.org)... 184.26.162.89, 184.26.162.88
Connecting to download.virtualbox.org (download.virtualbox.org)|184.26.162.89|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18028050 (17M) [text/plain]
Saving to: ‘ Oracle_VM_VirtualBox_Extension_Pack-5.0.0.vbox-extpack’ 

Oracle_VM_VirtualBox_Exten 100%[========================================> ]  17.19M   689KB/s   in 25s    

2016-05-31 03:13:17 (699 KB/s) - ‘ Oracle_VM_VirtualBox_Extension_Pack-5.0.0.vbox-extpack’  saved [18028050/18028050]

To install the extension pack, you should have Virtualbox 5.0 installed, once you downloaded vbox-extpack open with Virtualbox. If it doesn' t work, open Virtaulbox&rarr Preferences &rarr Extensions after that browse for the vbox-extpack to install.

To Update VirtualBox

If you like to update the VirtualBox with latest version, execute the below command.

On RHEL/CentOS/Fedora

# yum update VirtualBox-5.0

On Ubuntu/Linux Mint

user1@linuxhelp:~$ sudo apt-get install VirtualBox-5.0

To Remove VirtualBox

If you want to remove VirtualBox completely, just use the below command to remove it.

On RHEL/CentOS/Fedora

# cd /etc/yum.repos.d/
# rm -rf virtualbox.repo
# yum remove VirtualBox-5.0

On Ubuntu/Linux Mint

user1@linuxhelp:~$ sudo apt-get remove virtualbox-5.0
Tag : Virtualbox
FAQ
Q
How to install VirtualBox on Linuxmint?
A
You can use the following link to get the procedure to install VirtualBox on Linuxmint "https://www.linuxhelp.com/how-to-install-virtualbox-v-5-1-on-linuxmint-18-3/"
Q
Can I Will the licensing terms of the VirtualBox base package be changed in the future?
A
We are not currently planning to do so, but it doesn't really matter. The license that applies to the VirtualBox base package is perpetual and cannot be taken back unless you violate the license. Even if Oracle were to change the license again, this would only affect future versions, and anybody still in compliance would still be permitted to redistribute the existing VirtualBox code under the terms of the GPLv2.
Q
Can I redistribute the VirtualBox base package binaries?
A
Yes. The GPLv2 allows you to distribute the VirtualBox base package binaries, in modified or unmodified form, as long as you adhere to the terms and conditions of the GPLv2.
Q
What is a “VirtualBox Guest Additions”?
A
The “VirtualBox Guest Additions” are a set of software drivers and utilities that are shipped as a subset of the VirtualBox base package and that are installed inside a virtual machine for better performance and usability. Like the VirtualBox base package, the VirtualBox Guest Additions are licensed under the GPLv2.
Q
Can I redistribute VirtualBox Guest Additions?
A
Yes. The GPLv2 allows you to distribute the VirtualBox Guest Additions, in modified or unmodified form, as long as you adhere to the terms and conditions of the GPLv2.