VirtualBox Guest Additions on Fedora 22/21, CentOS/RHEL 7.1/6.7/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 22/21/20/19/18/17/16/15/14/13/12, CentOS 7.1/6.7/5.11, Red Hat (RHEL) 7.1/6.7/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

If you have CentOS/RHEL 6.7 then check this comment. You need older kernel.

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

159 Comments

  1. Good Tips – it works. For Centos 7 and for Centos 6 also.

    Reply
    • Hi JR,
      I have installed one Oracle Linux 6.6 hosted by Windows. I’m student and I used your post to install Guest Additions, just to split my screen in two parts, but after reboot process the Oracle VM VirtualBox is not resizing the screen. Could you please help me to solve this problem?

      Regeards,
      Rafael

      Reply
      • su –
        mkdir /media/vboxguest
        run df -h
        see where areyou seeing your VirtualBoxGuestAdditions media mostly in /media/VirtualBoxGuestAdditions or run/media/root/VirtualBoxGuestAdditions (on RHEL7)
        go to that directory and execute cp /VBoxLinuxAdditions.run /media/vboxguest/
        yum update kernel*
        yum install gcc kernel-devel kernel-headers dkms make bzip2 perl
        cd /media/vboxguest
        run ./VBoxLinuxAdditions.run

        no need to do any other step. in my case it worked always and have tried more than 20 times.

        Reply
  2. Thanks a lot for this post! It was a life-saver for me.
    In certain regards I am forced to use CentOS and I don’t understand why this is so annoying compared to Ubuntu.

    Reply
  3. Thanks a Lot. Installed GA successfully for Centos 6.5 on VirtualBox with your guidelines.

    Reply
  4. Great instructions! Thanks so much–

    Reply
  5. Unfortunately my install with a Red Hat 6.7 guest failed during the:
    sh ./VBoxLinuxAdditions.run

    The output indicated:
    Building the OpenGL support module [FAILED]
    (Look at /var/log/vboxadd-install.log to find out what went wrong)

    The logfile indicated:

    make KERNELRELEASE=2.6.32-573.1.1.el6.x86_64 -C /lib/modules/2.6.32-573.1.1.el6.x86_64/build M=/var/lib/dkms/vboxguest/4.3.30/build………(bad exit status: 2)
    Error! Bad return status for module build on kernel: 2.6.32-573.1.1.el6.x86_64 (x86_64)
    Consult /var/lib/dkms/vboxguest/4.3.30/build/make.log for more information.

    and that logfile indicated:

    In file included from /var/lib/dkms/vboxguest/4.3.30/build/vboxvideo/vboxvideo_drm.c:79:
    include/drm/drmP.h:64:26: error: uapi/drm/drm.h: No such file or directory
    include/drm/drmP.h:65:31: error: uapi/drm/drm_mode.h: No such file or directory

    uapi/drm exists under /usr/include, so creating a symbolic link resulted in a different error in this log:

    /var/lib/dkms/vboxguest/4.3.30/build/vboxvideo/vboxvideo_drm.c:129: error: ‘drm_mmap’ undeclared here (not in a function)
    make[2]: *** [/var/lib/dkms/vboxguest/4.3.30/build/vboxvideo/vboxvideo_drm.o] Error 1

    If I look at vboxvideo_drm.c, the corresponding code is:


    # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
    /* This shouldn't be necessary even for old kernels as there is
    * nothing sensible to mmap. But we play safe and keep it for
    * legacy reasons. */
    .mmap = drm_mmap,
    # endif

    so it appears that VirtualBox hasn't pulled in the correct headers, or has a kernel mismatch.
    Any idea what the source of the problem might be?
    Thanks

    Reply
  6. Unbelievable! This solution was posted 5 years ago and still helping to the folks!. Thank you so much JR

    Reply
  7. I am getting building opengl support failed error after doing these steps. Currently I have centOS6.7 version and virtual box 5.0

    Reply
  8. Hello Marc and Lakshmi,

    You are totally right. VBoxGuestAdditions are not compatible with CentOS 6.7 kernel. Easy way is install older kernel and kernel-devel and use it. First update your host system and VirtualBox to version 5.0.2.

    Then install CentOS 6.6 kernel

    Then reboot and select kernel-2.6.32-504

    Compile VirtualBox Linux Additions

    And reboot once again and select kernel-2.6.32-504.

    Next step is protect older kernel version, so yum update shouldn’t remove it:

    Now you should have working VirtualBox Guest Additions on CentOS 6.7. You could try to rebuild Guest Additions when new kernels are released, but this is just simple workaround until Vbox Guest Additions are fixed.

    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=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">