VirtualBox Guest Additions on Fedora 21/20, CentOS/RHEL 7/6.6/5.11

virtualbox-logo-smallThis is guide, howto install Oracle VirtualBox Guest Additions on Fedora, CentOS and Red Hat (RHEL). This guide should work with Fedora 21/20/19/18/17/16/15/14/13/12, CentOS 7/6.6/5.11, Red Hat (RHEL) 7/6.6/5.11.

VirtualBox Guest Additions is special software that can be installed inside Linux virtual machines to improve performance and make integration much more seamless. Among the features provided by these VirtualBox Guest Additions are mouse pointer integration and arbitrary screen solutions (e.g. by resizing the guest window).

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

1. Change root user

2. Mount VirtualBox Guest Additions

Click Devices > Install Guest Additions… on VirtualBox
VirtualBox Install Guest Additions

Mount VirtualBox Guest Additions device

3. Make sure that you are running latest kernel

Update virtual machine kernel and reboot

4. Install following packages

On CentOS/Red Hat (RHEL) 7/6/5, EPEL repo is needed

Install following packages

5. Add KERN_DIR environment variable

6. Install Guest Additions

Output looks like following:

7. Reboot guest system

Then VirtualBox Guest Additions install is ready.

Check also:

Install VirtualBox (with yum) on Fedora, CentOS, Red Hat (RHEL)

Share this post

149 Comments

  1. Hi Barry.

    Try it in command line

    KERN_DIR=/usr/src/kernels/$(uname -r)
    export Kern_DIR

    ./VBoxLinuxAdditions.run

    Reply
  2. Excellent…worked like a charm for me on Centos 5.4 and VB 4.3.6 R91406

    I had to make one change for the export KERN_DIR to work.
    export KERN_DIR=’/usr/src/kernels/’uname -r-uname -m

    The closing single quote before first `uname

    Reply
  3. Thanks very much, this guide saves me!

    Reply
  4. Awesome! You save my time! Thanks for help guys!

    Reply
  5. Thank you! This is exactly what I was looking for and so straight-forward! I spent hours last night scouring official install instructions to no avail, and this morning your instructions got it done in minutes!

    Reply
  6. I was having a number of errors pertaining to OpenGL module getting installed:

    Building OpenGL support module … failed

    I looked into this further from some of the posts in this thread and what helped me was this :

    [snip]
    $ yum whatprovides “*drm/drm.h”
    kernel-devel installed
    kernel-headers installed
    libdrm-devel installed
    [/snip]

    i didn’t have the libdrm-devel package installed. once i installed it…boom. works, thought i’d add this comment for anyone else that encounters this error.

    Reply
    • Hi TheodoreC,

      Thank you for your input! What host OS you are using?

      Reply
  7. Hi,

    Have installed centos6.5 on virtual machine, but when restarting the VM the installed gcc/g++ are not found.

    suggestions?

    Reply
  8. Has anyone of you can tell if the “Fullscreen” mode is functional after applying the procedures described here?

    Thanks in advance.

    Reply
    • Hi RS,

      Yes, full screen should work after installing VirtualBox Guest Additions.

      Reply
  9. anyone have this working on CentOS 7?

    has no member named ‘numa_next_reset’

    Reply
  10. I don’t believe CentOS/RHEL 7 is supported in the current stable Virtualbox release (4.3.12). I run into the same error.

    Apparently this will be solved in 4.3.14, the release candidate is already available and should fix the issue. Unfortunately I need it to be available in the stable branch to make any use of it as I need to provide it for multiple users. Guess we’ll just have to wait for 4.3.12 to reach stable. :-(

    Reply
  11. hi. i have same issue.please help

    [root@localhost yum.repos.d]# uname -a
    Linux localhost.localdomain 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    [root@localhost yum.repos.d]# rpm -qa kernel\* |sort -V
    kernelshark-2.2.1-3.fc20.x86_64
    kernel-3.11.10-301.fc20.x86_64
    kernel-3.15.6-200.fc20.x86_64
    kernel-debug-3.15.6-200.fc20.x86_64
    kernel-debug-devel-3.15.6-200.fc20.x86_64
    kernel-debug-modules-extra-3.15.6-200.fc20.x86_64
    kernel-devel-3.15.6-200.fc20.x86_64
    kernel-doc-3.15.6-200.fc20.noarch
    kernel-headers-3.15.6-200.fc20.x86_64
    kernel-modules-extra-3.11.10-301.fc20.x86_64
    kernel-modules-extra-3.15.6-200.fc20.x86_64
    kernel-tools-3.15.6-200.fc20.x86_64
    kernel-tools-libs-3.15.6-200.fc20.x86_64
    kernel-tools-libs-devel-3.15.6-200.fc20.x86_64

    Reply
    • Hi I47,

      Please boot using latest kernel 3.15.6-200.fc20.x86_64, then try again.

      Reply
  12. Hello, someone could help?

    [root@localhost ~]# service vboxdrv setup
    Stopping VirtualBox kernel modules [ OK ]
    Recompiling VirtualBox kernel modules [FAILED]
    (Look at /var/log/vbox-install.log to find out what went wrong)

    [root@localhost ~]# cat /var/log/vbox-install.log
    Makefile:183: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.
    Makefile:183: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.
    Makefile:183: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

    uname -r
    3.8.13-35.3.3.el6uek.x86_64

    echo $KERN_DIR
    /usr/src/kernels/2.6.32-431.23.3.el6.x86_64/

    I’m new to Linux.
    Thanks.

    Reply
  13. I followed your install process and this is what i got. I couldnt start up VB from the command line(although i was able to start using the front).
    I also hav a problem when i was trying to mount the cdrom as additional mount.
    Below is what i got. PLease help.

    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    VirtualBox-4.3 x86_64 4.3.14_95030_el6-1 virtualbox 75 M
    Installing for dependencies:
    SDL x86_64 1.2.14-3.el6 public_ol6_latest 192 k

    Transaction Summary
    ================================================================================
    Install 2 Package(s)

    Total download size: 75 M
    Installed size: 151 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/2): SDL-1.2.14-3.el6.x86_64.rpm | 192 kB 00:00
    (2/2): VirtualBox-4.3-4.3.14_95030_el6-1.x86_64.rpm | 75 MB 01:36
    ——————————————————————————–
    Total 790 kB/s | 75 MB 01:37
    warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY
    Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc
    Importing GPG key 0x98AB5139:
    Userid: “Oracle Corporation (VirtualBox archive signing key) ”
    From : https://www.virtualbox.org/download/oracle_vbox.asc
    Is this ok [y/N]: y
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing : SDL-1.2.14-3.el6.x86_64 1/2
    Installing : VirtualBox-4.3-4.3.14_95030_el6-1.x86_64 2/2

    Creating group ‘vboxusers’. VM users must be member of that group!

    No precompiled module for this kernel found — trying to build one. Messages
    emitted during module compilation will be logged to /var/log/vbox-install.log.

    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 2.6.32-358.el6.x86_64 cannot be found at
    /lib/modules/2.6.32-358.el6.x86_64/build or /lib/modules/2.6.32-358.el6.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)
    Verifying : SDL-1.2.14-3.el6.x86_64 1/2
    Verifying : VirtualBox-4.3-4.3.14_95030_el6-1.x86_64 2/2

    Installed:
    VirtualBox-4.3.x86_64 0:4.3.14_95030_el6-1

    Dependency Installed:
    SDL.x86_64 0:1.2.14-3.el6

    Complete!
    [root@new-host-2 yum.repos.d]# service vboxdrv setup
    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 2.6.32-358.el6.x86_64 cannot be found at
    /lib/modules/2.6.32-358.el6.x86_64/build or /lib/modules/2.6.32-358.el6.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)
    [root@new-host-2 yum.repos.d]# usermod -a -G vboxusers tricky
    [root@new-host-2 yum.repos.d]# VirtualBox
    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
    available for the current kernel (2.6.32-358.el6.x86_64) or it failed to
    load. Please recompile the kernel module and install it by

    sudo /etc/init.d/vboxdrv setup

    You will not be able to start VMs until this problem is fixed.
    No protocol specified
    Failed to open the X11 display!
    [root@new-host-2 yum.repos.d]# KERN_DIR=/usr/src/kernels/uname -r-uname -m
    [root@new-host-2 yum.repos.d]# KERN_DIR=/usr/src/kernels/2.6.18-194.11.1.el5-x86_64
    [root@new-host-2 yum.repos.d]# export KERN_DIR
    [root@new-host-2 yum.repos.d]# cd ~
    [root@new-host-2 ~]# mkdir /media/VirtualBoxGuestAdditions
    [root@new-host-2 ~]# mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
    mount: you must specify the filesystem type
    [root@new-host-2 ~]# mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
    mount: you must specify the filesystem type

    Reply
    • Hi tricky,

      Could you first post output of following commands:

      Reply
  14. Hi, I know this is an old post but wanted to let you know I have been trying for 5 days to install VirtualBox Guest Additions on Centos 6. I have only had about 5 hrs sleep in those 5 days but your post did it for me. Thank you. At 3:32 am on the west coast I can finally get about 3 more hrs sleep then its back to work.
    Great Post and thanks again
    Paul

    Reply
  15. It seems like you should mount the Guest Additions CD image at the very end – since there are several reboot steps that would unmount the CD right? I noticed that once it came to actually running the installer from the CD, there was nothing in the previously mounted directory.

    Reply

Trackbacks/Pingbacks

  1. Install VirtualBox 3.2.8 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 6 | If Not True Then False - [...] Groupusermod -a -G vboxusers user_nameStart VirtualBoxUse launcher or simply:VirtualBoxCheck also:Install VirtualBox Guest Additions on Fedora 13, CentOS 5.5, Red …
  2. Инсталяция virtualbox 4 guest additions на centos 5. | Якши Гора - [...] Вот классная ссылка на статью о том как устанавливать virtualbox guest additions на centos 5: Install VirtualBox Guest Additions …
  3. Install VirtualBox Guest Additions on Fedora 16/15, CentOS/RHEL 6/5.7 « Micro Tech Bytes - [...] http://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-h... Share this:TwitterFacebookLike this:LikeBe the first to like this post. [...]
  4. failed to install vbox addon on Fedora 17 - [...] guys, I'm trying to install virtualbox addon tools on Fedora 17. I'm using this guide http://www.if-not-true-then-false.co...-red-hat-rhel/ …
  5. I am new in Linux OS, NEED HELP IN RED HAT 9 INTERNET CONNECTION WITH VMWARE 9 - [...] Since you also asked about virtualbox-guest-additions, follow this guide: http://www.if-not-true-then-false.co...-red-hat-rhel/ [...]

Submit a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">