How to Install Latest VirtualBox 6.0 in Linux

VirtualBox is an open source cross-platform virtualization software, it can be installed on any operating system and enable you to install and run multiple guest operating systems on same computer.

For example, if you install it on your Linux system, you can run Windows XP operating system under it as a Guest OS or run Linux OS on your Windows system and so on. This way, you can install and run as many as guest operating systems as you like, the only limit is disk space and memory.

Recently Oracle has released latest stable version of Virtualbox 6.0.0, the newest version of Virtual box comes with so many major changes and new features added to it.

Whats new in Virtualbox 6.0

  • Added support for exporting a virtual machine to Oracle Cloud Infrastructure.
  • A much improved HiDPI and scaling support, along with superior detection and per-machine configuration.
  • A Major rework of user interface with smooth and easy setup of virtual machines.
  • A new file manager allows user to manage the guest file system and copy files between host and guest.
  • A major update of 3D graphics device emulation on Linux guests.
  • vboximg-mount utility for hosts enables users to access the content of guest disks on the host.
  • Added support for using Hyper-V on Windows host.

You can see the complete new change log details about VirtualBox 6.0 on their Official Changelog Page.

This guide explains how to install VirtualBox 6.0 on RHEL, CentOS and Fedora systems using VirtualBox’s own repository with YUM and DNF (for Fedora 22+ releases) tool.

This guide also explains how to install VirtualBox 6.0 on Debian, Ubuntu and Linux Mint systems using VirtualBox’s own repository with APT-GET or APT command.

Installing VirtualBox 6.0 in RHEL/CentOS and Fedora

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

# yum remove VirtualBox*
# dnf remove VirtualBox*  [On Fedora 22+]

Adding VirtualBox Repository

Next add the VirtualBox own repository to install latest VirtualBox 6.0 on following systems.

For RHEL/CentOS 7/6/
# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
For RHEL/CentOS 5
# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh epel-release-5-4.noarch.rpm
For Fedora 24-29
# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

Install Dependency Packages for VirtualBox

VirtualBox uses vboxdrv kernel module to control and allocate physical memory for execution of guest operating systems. Without this module, you can still use the VirtualBox to create and configure virtual machines, but they will not work.

So, to make VirtualBox fully functional you will need to update your system first, then install some additional modules like DKMS, kernel-headers and kernel-devel and some dependency packages.

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

Install VirtualBox 6.0

Once you’ve installed all the needed dependency packages, you can install latest version of VirtualBox using following command.

# yum install VirtualBox-6.0

Rebuild Kernel Modules for VirtualBox 6.0

The below command will automatically create vboxusers group and user and also search and automatically rebuild required kernel modules.

------------- Fedora 22+ and CentOS/RHEL 7 ------------- 
/usr/lib/virtualbox/vboxdrv.sh setup
 
------------- Fedora 18-16 and CentOS/RHEL 6/5 ------------- 
/etc/init.d/vboxdrv setup
## OR ##
service vboxdrv setup

If the above build process fails, you will get a warning messages similar to below.

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-4.19.0-1.el7.elrepo.x86_64

Then you need to first check your installed kernel and then install needed kernel-devel using following commands.

# uname -r
# yum install kernel-devel-CURRENT_KERNEL

Note: replace CURRENT_KERNEL with string you get from uname -r.

Now run the build setup again.

# /usr/lib/virtualbox/vboxdrv.sh setup

Next, replace user_name in the following command with your own user name.

# usermod -a -G vboxusers user_name

Troubleshooting

If you get any error message like KERN_DIR or if your kernel source directory not detected automatically by build process, you can set it by using following command. Make sure you change kernel version according to your system as shown in red color.

## RHEL / CentOS / Fedora ##
KERN_DIR=/usr/src/kernels/4.19.0-1.el7.elrepo.x86_64

## Export KERN_DIR ##
export KERN_DIR

Installing VirtualBox 6.0 in Debian, Ubuntu and Linux Mint

First, uninstall any earlier version of Virtualbox if any.

$ sudo apt-get remove virtualbox-*

Next, install latest VirtualBox 6.0 version using official Virtualbox repository. To add the repository, use the following command as shown.

$ sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install virtualbox-6.0

Starting VirtualBox 6.0

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

# VirtualBox
VirtualBox 6.0 Screenshots on CentOS 7
VirtualBox 6.0 Running on CentOS 7

VirtualBox 6.0 Running on CentOS 7

Create Virtalbox New Guest Machine

Create Virtalbox New Guest Machine

Installing VirtualBox Extension Pack

If you need some additional functionality such as VirtualBox RDP, PXE, ROM with E1000 support and USB 2.0 Host Controller support, etc. You need to download and install the VirtualBox Extension Pack using following wget command.

# # wget http://download.virtualbox.org/virtualbox/6.0.0/Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack

To install the extension pack, you must have Virtualbox 6.0 installed, once you downloaded vbox-extpack open with Virtualbox as shown below.

If it doesn’t work out, then open Virtaulbox –> Preferences –> Extensions and browse for the vbox-extpack to install it.

Install Virtualbox Extension Pack

Install Virtualbox Extension Pack

Read Also: How to Enable USB in VirtualBox

Updating VirtualBox

If you want to update the VirtualBox with latest version in the future, you can simply run the following command to update it.

On RHEL/CentOS/Fedora
# yum update VirtualBox-6.0
On Ubuntu/Linux Mint
# apt-get install VirtualBox-6.0

Remove VirtualBox

If in case you want to remove VirtualBox completely, just use the following command to remove it completely from your system.

On RHEL/CentOS/Fedora
# cd /etc/yum.repos.d/
# rm -rf virtualbox.repo
# yum remove VirtualBox-6.0
On Ubuntu/Linux Mint
# apt-get remove VirtualBox-6.0

You can also Download VirtualBox 6.0 for other Linux, Windows and Mac OS X platforms.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

134 Responses

  1. Hermouche says:

    For those who still have a problem when they launch the command:

    $ sudo /sbin/vboxconfig
    

    I’ve solved my problem by disabling the “secure boot” from the bios (i am using the standard Unified Extensible Firmware Interface “UEFI”)

    My machine:
    CentOS Linux release 7.3.1611 (Core)
    Linux AP-amphi.ensm.intranet 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

  2. Sevki Akdemir says:

    File: /var/log/vbox-install.log;

    Makefile:185: *** Error: unable to find the sources of your current Linux kernel. 
    Specify KERN_DIR= and run Make again. Stop.
    make KBUILD_VERBOSE=1 SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 CONFIG_MODULE_SIG= -C /usr/src/kernels/2.6.32-042stab116.1/ -j4 modules
    make[1]: warning: -jN forced in submake: disabling jobserver mode.
    test -e include/linux/autoconf.h -a -e include/config/auto.conf || (            \
            echo;                                                           \
            echo "  ERROR: Kernel configuration is invalid.";               \
            echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";      \
            echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
            echo;                                                           \
            /bin/false)
    

    Can any body help ?

    • Ravi Saive says:

      @Sevki,

      Could you show me the output of the following commands:

      # rpm -qa kernel* | sort
      # uname -mr
      # echo $KERN_DIR
      

      I suggest you to first update the system and then try to install Virtualbox.

  3. sayanthan says:

    hi.
    i currently used Ubuntu 16.04 (xenial).
    i try to update then i got flowing warning ..
    “W: GPG error: http://download.virtualbox.org/virtualbox/debian xenial InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
    W: The repository ‘http://download.virtualbox.org/virtualbox/debian xenial InRelease’ is not signed.
    N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.'”

    after install time
    WARNING: The following packages cannot be authenticated!
    virtualbox-5.1
    Install these packages without verification? [y/N]

    what to do now?
    is i continue? is this better or not?

    • Ravi Saive says:

      @Sayanthan,

      First you need to remove old Virtualbox keys before doing a upgarde, here is how to remove the old keys:

      $ sudo apt-key list
      

      Find the offending key (something like “virtualbox”, after “pub”, xxx/KEYHERE) and do:

      $ sudo apt-key del VirtualBox-KEYHERE
      

      Then follow the instructions as described in this article..

  4. lance-link says:

    I used the above procedure to install VirtualBox 5.1 in a Fedora host and a Windows 7 guest, however, I have to run # /usr/lib/virtualbox/vboxdrv.sh setup each time after reboot/shutdown inorder to get any devices to appear in VB > Settings > USB > USB Device Filters. How can I make the change permanent so I don’t have to run # /usr/lib/virtualbox/vboxdrv.sh all the time?

    I posted this question a few minutes ago but the email address was wrong.
    Thanks,

  5. lance-link says:

    I followed the installation process for VirtualBox in a Fedora 24 host and a Windows 7 guest. Everything worked fine, but I have to run # /usr/lib/virtualbox/vboxdrv.sh setup each time after a reboot/shutdown inorder to get any listings in Settings > USB > USB Device Filters.

    How can I make the USB Filter choices permanent so i don’t have to run # /usr/lib/virtualbox/vboxdrv.sh?

    Thanks.

  6. BUSUYI AKINSOLA says:

    I try to install virtualbox 5 on centos 7 but he gave the header problem then I install it but still having the issue ,plus what should I do

    # yum install kernel-devel

    • Ravi Saive says:

      @Busuyi,

      Could you share the exactly what error message is giving by Virtualbox? so that it will help us to better identify the problem..

  7. waleed says:

    i get this error when run virtualbox

    Qt FATAL: This application failed to start because it could not find or load the Qt platform plugin “xcb”.

    Available platform plugins are: xcb.

    Reinstalling the application may fix this problem.
    Aborted (core dumped)

    • Ravi Saive says:

      @Waleed,

      It seems xcb libraries are not installed on the system, to install just run the following command will fix the error:

      $ sudo aptitude install libdouble-conversion1 libxcb-render-util0 libxcb-image0 libxcb-icccm4 libxcb-randr0 libxcb-keysyms1 libxcb-xkb1 libxkbcommon-x11-0
      
      • Steve says:

        I have the same problem, I checked this list and installed the first item which was the only one missing and still get this error, I am running on Linux Mint 17.1

        • Ravi Saive says:

          @Steve,

          I suggest you to install all missing xcb related packages and see, if it solves the error..

          • Steve says:

            Ravi,
            The only package that was missing was libdouble-conversion1 and I have already installed it. So all the packages listed above are installed but it still gives me this error.

          • Steve says:

            Ravi,
            I found this on another site, if I run this
            P=/usr/lib/virtualbox; sudo LD_LIBRARY_PATH=$P:$P/plugins/platforms $P/VirtualBox
            in a terminal then Virtualbox opens like it should and it works, so doesn’t seem to be missing component.

          • Ravi Saive says:

            @Steve,

            Thanks for sharing the tip, I hope it will help other users, who are facing similar issue….

    • Nenad Cimerman says:

      First of all, many thanks for this very useful guide!

      However, in my case (CentOS 5.11) with the current VirtualBox Version 5.1.2, I ran into a problem which blocked virtualbox when started, so I could not use it at all:
      $ virtualbox
      Qt FATAL: This application failed to start because it could not find or load the Qt platform plugin “xcb”.

      Available platform plugins are: xcb.

      Reinstalling the application may fix this problem.

      After some research, I discovered, that the required “xcb” libraries are installed in /usr/lib/virtualbox and /usr/lib/virtualbox/plugins.

      So the solution is quite simple. As “root” (or using sudo) user do the following two steps:
      1. create a new file containing the two paths mentioned above
      # cd /etc/ld.so.conf.d
      # vi virtualbox-5.1.2.conf
      /usr/lib/virtualbox/
      /usr/lib/virtualbox/plugins/platforms/
      2. Update system wide configuration of “ldd”
      # /sbin/ldconfig

      Hope this helps some people to overcome this missing peace in the installation procedure of the VirtualBox package.
      Have fun!

      workaholic

  8. Peter Schneider says:

    @simon
    Although six weeks are gone since your question, just a hint:
    I just installed VirtualBox-5 on my Fedora-21 box. The script ‘vboxdrv.sh’ did the job for me:
    # /usr/lib/virtualbox/vboxdrv.sh setup

    • Ravi Saive says:

      @Peter,

      Thanks for the tip, hope it will other users.. Keep sharing such hints with us and keep connected to Tecmint…

    • Dandu Rajeev says:

      Hi Peter,
      I have tried this. But got this error:

      Stopping VirtualBox kernel modules [ OK ]
      Uninstalling old VirtualBox DKMS kernel modules [ OK ]
      Trying to register the VirtualBox kernel modules using DKMSError! echo
      Your kernel headers for kernel 4.5.7-200.fc23.x86_64 cannot be found at
      /lib/modules/4.5.7-200.fc23.x86_64/build or /lib/modules/4.5.7-200.fc23.x86_64/source.
      [FAILED]
      (Failed, trying without DKMS)
      Recompiling VirtualBox kernel modules [FAILED]
      (Look at /var/log/vbox-install.log to find out what went wrong)

      Any help will be appreciated.
      Thanks

      • Ravi Saive says:

        @Dandu,

        It seems me to like a Kernel header problem, you should install kernel-headers using:

        # yum install kernel-devel
        
  9. simon says:

    Hello,
    sorry for my poor English… I fail to install on Centos 7 at start stem, neither of these commands succeed:
    # /etc/init.d/vboxdrv setup
    OR
    # service vboxdrv setup

    =>

    /etc/init.d/vboxdrv setup
    bash: /etc/init.d/vboxdrv: No such file or directory

    service vboxdrv setup
    The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

    I found no error in /var/log/vbox-install.log

    Any hints ? Thanks !

    • Ravi Saive says:

      @Simon,
      Have you correctly installed and enabled VirtualBox repository under /etc/yum.repos.d/ directory in your CentOS 7?

      • Dandu Rajeev says:

        similar issue for me. I installed virtualbox repo in /etc/yum.repos.d/. I am using Fedora 23. I badly need VirtualBox. Please give me some solution to make it work. Thanks!

        • John Cook says:

          It appears there is a minor error in this guide. The suggested options for a RHEL/CentOS 7 host (or Fedora 19-24 hosts) are actually only suitable for RHEL/CentOS 5/6 hosts (or Fedora 16-18 hosts). Here is the change I made to the author’s procedure that allowed me to get VirtualBox 5.1 working on my CentOS 7 host:

          /usr/lib/virtualbox/vboxdrv.sh setup
          usermod -a -G vboxusers user_name

          NOTE: Replace “user_name” with an actual user name.

          I was able to otherwise follow this guide and just replace the portion concerning rebuilding the kernel modules with what I supplied above.

          Source: http://www.if-not-true-then-false.com/2010/install-virtualbox-with-yum-on-fedora-centos-red-hat-rhel/

          • Ravi Saive says:

            @John,

            Thanks a ton for pointing out, we’ve included the instructions as suggested, hope it will help other users who are facing similar issues with latest version of CentOS/RHEL and Fedora..

  10. AJ says:

    What’s the deal with the 32bit only guests?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.