Installing Guest Additions and DKMS on Centos.

I was trying to install guest additions on my Centos operating system but faced a lot of problems. Though the idea was very simple as all you have to do was to install DKMS package  on your centos operating system and run the install virtual box guest additions setup, but the main problem is that dkms package is not available on your centos,  it is a third party repository. So I believe there are a lot of new users who face this issue (I being one of them).

Following steps will help in installing guest additions on your centos.

Step1: update everything( though not really required but still I took this step 1st)

Step2: make a directory rpm using the following commands and go in that directory and download the rpm package from this link

$ mkdir rpm

$ cd rpm

$ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

$ rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

$ yum install htop

now if you get an error something like this

error: Failed dependencies:
rpmlib(FileDigests) <= 4.6.0-1 is needed by rpmforge-release-0.5.2-2.el6.rf.i686
rpmlib(PayloadIsXz) <= 5.2-1 is needed by rpmforge-release-0.5.2-2.el6.rf.i686

That means you have installed your centos virtual machine from cloudera which is centos5 and you have downloaded rpm package for centos6 so all you have to do is to change that package and download package for centos5. You can also check if you are running a 32 bit machine or a 64 bit machine as there are two packages one is for 32 bit machine and the other for 64 bit. To check which machine you are running just type the following command

$uname -i

if you get i386 or i686 that means you are running 32 bit machine and if you get x86_64 that means you are running a 64 bit machine.

Step3. Install kernel-devel

$ sudo yum install kernel-devel

Step4. So almost everything is done and you are ready to install  dkms package

sudo yum install dkms

if everything goes fine dkms package will install successfully, without any issues.

Step5. This will be the final step

Insert VboxGuestAdditions.iso and go to the folder which will be probably in

/media/VboxGuestAdditions

and run the following command

$ sh ./VboxLinuxAdditions.run

 

This will successfully install Guest Additions on Centos.