Install VirtualBox Guest Additions on CentOS 6.4
As part of setting up a CentOS virtual machine, installing the virtualbox guest additions is an important part of the process.
Note : This is for CentOS 6.X. For other distributions see : install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel
1. Add your current user to sudoers
2. Install GCC :
$> yum install kernel-devel gcc
3. Make sure you have VirtualBox version 4.2.12 or above. If not, upgrade by downloading package directly from virtualbox website :
https://www.virtualbox.org/wiki/Linux_Downloads
TIP: Do not use yum install or apt-get to install VirtualBox : you will get an older version, or see Troubleshooting section below to add software sources.
4. The most important point and the goal of this step is to have in sync your kernel (indicated by uname -r) and the kernel headers files. In the base distribution of CentOS 6.4, the kernel is 2.6.32-358. But right now if install the latest kernel-devel package you will get 2.6.32-411. So your option are either to install the old headers manually, or upgrade your kernel to the latest.
Install the latest kernel binaries
$> yum update kernel*
$> reboot
Install the latest kernel headers :
$> yum install kernel-devel
or
$> yum install kernel-devel-`uname -r`
5. Important to add the KERN_DIR environment variable using these lines :
$> KERN_DIR=/usr/src/kernels/`uname -r`
$> export KERN_DIR
## Or for CentOS 5 and Red Hat 5
$> KERN_DIR=/usr/src/kernels/`uname -r`-`uname -m`
5. Run this line :
$> sudo /etc/init.d/vboxadd setup
6. Install the Guest additions CD-rom by clicking Devices | Install Guest Additions
Troubleshooting : Adding software sources
## CentOS 6 and Red Hat (RHEL) 6 ## $> rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ## CentOS 5 and Red Hat (RHEL) 5 ## $> rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Error: Your kernel headers for kernel 2.6.32-358.el6.i686 cannot be found at (...)
Solution: Make sure your kernel header are in sync with the running kernel. The recommended method is to upgrade your kernel to the latest, which is sure to have a corresponding header package via yum install kernel-devel. Redo step 4 and 5.
Recent Comments