VirtualBox 5.0 on Fedora 23/22, CentOS/RHEL 7.2/6.7/5.11

virtualbox-logo-smallOracle VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. VirtualBox is a general-purpose full virtualizer for x86 hardware. Targeted at server, desktop and embedded use, it is now the only professional-quality virtualization solution that is also Open Source Software.

VirtualBox supports a large number of guest operating systems:

  • Windows 3.x
  • Windows NT 4.0
  • Windows 2000
  • Windows XP
  • Windows Server 2003
  • Windows Vista
  • Windows 7
  • Windows 8
  • Windows 8.1
  • DOS
  • Linux (2.4, 2.6, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11)
  • Solaris
  • OpenSolaris
  • OpenBSD

This guide shows howto install VirtualBox 5.0 (currently 5.0.12) on Fedora 23/22/21/20/19/18, CentOS 7.2/6.7/5.11, Red Hat (RHEL) 7.2/6.7/5.11. This guide uses Virtual Box own yum repositories.

Note: Fedora 17 users can install VirtualBox 4.3, Fedora 16 users can install VirtualBox 4.2, Fedora 15/14 users can install VirtualBox 4.1, Fedora 13 users can install VirtualBox 4.0 and Fedora 12 users can install VirtualBox 3.2.

1. Change to root User

2. Install Fedora or RHEL Repo Files

3. Update latest packages and check your kernel version

Update packages

Check that that you are running latest installed kernel version
Output of following commands version numbers should match:

Note: If you got kernel update or run older kernel than newest installed then reboot:

4. Install following dependency packages

CentOS 7/6/5 and Red Hat (RHEL) 7/6/5 needs EPEL repository, install it with following command:

5. Install VirtualBox Latest Version 5.0 (currently 5.0.12)

Note:
This command create automatically vboxusers group and VirtualBox user must be member of that group.
This command also build needed kernel modules.

Rebuild kernel modules with following command:

6. Add VirtualBox User(s) to vboxusers Group

Replace user_name with your own user name or some another real user name.

7. Start VirtualBox

Use launcher from menu or simply run:

Troubleshooting

If you have problems with KERN_DIR parameter or your kernel directory is not automatically detected then set KERN_DIR environment variable manually, using following method:

Check also:

Install VirtualBox Guest Additions on Fedora, CentOS, Red Hat (RHEL)

Share this post

567 Comments

  1. I typed
    dnf install VirtualBox-5.0
    And i got
    Last metadata expiration check performed 1:03:52 ago
    .
    No package VirtualBox-5.0 available

    Please help me

    Reply
  2. Hi,
    when entered the step:
    “dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-PAE-devel dkms” as a root on fedora 23, I got:
    “Last metadata expiration check performed 0:32:15 ago on Fri Jan 8 13:00:54 2016.
    Package binutils-2.25-15.fc23.x86_64 is already installed, skipping.
    Package gcc-5.3.1-2.fc23.x86_64 is already installed, skipping.
    Package make-1:4.0-5.1.fc23.x86_64 is already installed, skipping.
    Package patch-2.7.5-2.fc23.x86_64 is already installed, skipping.
    Package libgomp-5.3.1-2.fc23.x86_64 is already installed, skipping.
    Package glibc-headers-2.22-7.fc23.x86_64 is already installed, skipping.
    Package glibc-devel-2.22-7.fc23.x86_64 is already installed, skipping.
    Package kernel-headers-4.2.8-300.fc23.x86_64 is already installed, skipping.
    No package kernel-PAE-devel available.
    Package dkms-2.2.0.3-31.git.7c3e7c5.fc23.noarch is already installed, skipping.
    Error: Unable to find a match.”

    Any ideas how to go around this?
    Best Regards
    Maciej

    Reply
    • Hi Maciej,

      You are using wrong command. No PAE kernel on 64-bit system. Right command is first one:

      Reply
      • Thank you JR, everything worked great this time!

        Reply
  3. trying to install on fedora 23 got:
    root@penelope fman]# /usr/lib/virtualbox/vboxdrv.sh setup
    bash: /usr/lib/virtualbox/vboxdrv.sh: No such file or directory

    found nothing searching on google.

    any hint?

    Reply
    • Hi Francisco,

      Could you post output of following commands:

      Reply
      • [fman@penelope ~]$ rpm -qa VirtualBox\*
        VirtualBox-5.0.12-1.fc23.x86_64
        VirtualBox-kmodsrc-5.0.12-1.fc23.x86_64
        [fman@penelope ~]$

        The issue is that are some missing files and I can not understand why:

        [fman@penelope ~]$ ls /usr/lib/virtualbox/vboxdrv.sh -la
        ls: cannot access /usr/lib/virtualbox/vboxdrv.sh: No such file or directory

        Best regards

        Reply
        • Problems is that you are not using Oracle’s VirtualBox package. You have installed your packages (VirtualBox and VirtualBox-kmodsrc) some other source than virtualbox.org own repo.

          Could you also post output of following command:

          Reply
          • Here the output
            [root@penelope fman]# dnf list installed |grep VirtualBox
            VirtualBox.x86_64 5.0.12-1.fc23 @rpmfusion-free-updates-testing
            VirtualBox-kmodsrc.x86_64 5.0.12-1.fc23 @rpmfusion-free-updates-testing
            akmod-VirtualBox.x86_64 5.0.12-1.fc23 @rpmfusion-free-updates-testing
            kmod-VirtualBox-4.2.8-300.fc23.x86_64.x86_64

            I though I’ve followed the instructions indicated in this article, but maybe I’ve skip an step.

            thanks for your help

            Reply
            • You are probably running dnf install VirtualBox-5.0.12 like I did first time around. Even though in brackets it suggests .12 is the latest, you still need to enter it just as VirtualBox-5.0

              If you look at the y/N prompt before installing, you will see that the package is 5.0.12

              It’s only the command that is 5.0, other wise it will pull from the rpm repo.

              Hope this helps

              Reply
  4. Hi JR

    thanks for your post. I have been using it, and it has worked as a charm. But now using it for my new machine (new centos kernel) I got an error.:

    My machine.:

    uname -r

    3.10.0-327.4.4.el7.x86_64

    Virtual box version.:

    Tried first with:
    * VirtualBox-5.0-5.0.12_104815_el7-1.x86_64.rpm

    and after with:
    *VirtualBox-5.0-5.0.13_104971_el7-1.x86_64.rpm

    I got the same error.:

    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
    available for the current kernel (3.10.0-327.4.4.el7.x86_64) or it failed to
    load. Please recompile the kernel module and install it by

    sudo /sbin/rcvboxdrv setup

    You will not be able to start VMs until this problem is fixed.

    Naturally I did sudo /sbin/rcvboxdrv setup … But then I got.:

    Stopping VirtualBox kernel modules [ OK ]
    Uninstalling old VirtualBox DKMS kernel modules [ OK ]
    Trying to register the VirtualBox kernel modules using DKMS[ OK ]
    Starting VirtualBox kernel modules [FAILED]

    When start the Virtual box impossible to start any machine …:

    Any guess ?

    all the best, and thanks again for the post …

    Reply
    • Just as a complement … I am using CentOS 7.2

      Reply
      • Hi Miup,

        Just tested this again on CentOS 7.2 and I got it working. I use following command:

        I got following errors on dkms uninstall part using latest kernel:

        But it builds normally without errors and works normally:
        virtualbox-running-on-centos-72

        Reply
        • Hi JR.
          ……….

          Thanks for your replay. It turned out that the “problem” was with the BIOS. I needed to disable the UEFI boot and went to legacy. Not really sure why this fixed the problem. But it worked.

          As a complement, I needed to enable virtualization in the BIOS (intel virtualization) in order to get 64 bits distros for linux and windows at the virtual box. But this is quit well documented everywhere on internet.

          again, really thanks for the replay … I appreciated that.

          Reply
  5. Hi JR, you saved my day!! Thank you so much !! I was hitting hard to make virtualbox work in Fedora 23 [4.2.8-300.fc23.x86_64] and [4.3.3-300.fc23.x86_64] but i couldn’t.
    I’m detailing out the issues i encountered, for the benefit of other users.
    I initially installed virtualbox by ‘dnf install VirtualBox’.
    After installation, i tried to launch virtualbox from shell and i got this error:
    [srx@localhost ~]$ virtualbox
    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
    available for the current kernel (4.2.8-300.fc23.x86_64) or it failed to
    load. Please recompile the kernel module and install it by

    sudo /sbin/rcvboxdrv setup

    You will not be able to start VMs until this problem is fixed.
    Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile

    ———-
    But virtualbox launched. On starting a vm, i got this error msg : VirtualBox Kernel driver not installed (rc=-1908)…

    As i’m not a expert linux user, I tried various options from different forums but i couldn’t get it work.
    Finally I followed your steps exactly, plus one additional step – I HAD TO RESTART AFTER THE FINAL STEP as i was getting an error msg (Qt WARNING: Qt: Session management error… ) on launching virtualbox.
    After the restart, it worked like a charm…. Again thank you so much!!!

    Reply
  6. Thanks your tutorial is very usefull for me on fedora 23.

    Reply
  7. When im trying to open my VirtualSystem on VirtualBox wich is Kali Linux it gives me “Kernel Drive not installed (rc=-1908) and i have disabled secure boot

    Reply
  8. cat /var/log/vbox-install.log
    Uninstalling modules from DKMS
    Attempting to install using DKMS
    Failed to install using DKMS, attempting to install without
    Makefile:185: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Pare.

    Reply
  9. sudo /usr/lib/virtualbox/vboxdrv.sh setup
    Stopping VirtualBox kernel modules [ OK ]
    Uninstalling old VirtualBox DKMS kernel modules [ OK ]
    Trying to register the VirtualBox kernel modules using DKMSError! Could not find module source directory.
    Directory: /usr/src/vboxhost-5.0.14 does not exist.
    [FALHOU]
    (Failed, trying without DKMS)
    Recompiling VirtualBox kernel modules [FALHOU]
    (Look at /var/log/vbox-install.log to find out what went wrong)
    ➜ ~ cat /var/log/vbox-install.log
    Uninstalling modules from DKMS
    Attempting to install using DKMS
    Failed to install using DKMS, attempting to install without
    Makefile:185: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Pare.

    Reply
    • Hi Aristoteles,

      Could you post also output of following commands:

      Reply
      • ➜ ~ ls -la /usr/src/kernels
        total 12
        drwxr-xr-x. 3 root root 4096 Jan 30 23:08 .
        drwxr-xr-x. 4 root root 4096 Jan 31 16:27 ..
        drwxr-xr-x 23 root root 4096 Jan 30 23:08 4.3.3-303.fc23.x86_64

        ➜ ~ ls -la /usr/src
        total 16
        drwxr-xr-x. 4 root root 4096 Jan 31 16:27 .
        drwxr-xr-x. 14 root root 4096 Dez 22 23:53 ..
        drwxr-xr-x. 2 root root 4096 Set 10 05:23 debug
        drwxr-xr-x. 3 root root 4096 Jan 30 23:08 kernels

        Reply
  10. Man You are great. I had 2 issues, I searched whole internet and both solutions I found here. :)

    Reply

Submit a Comment

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