Tutorial

How To Install VirtualBox on CentOS 6.3 x64

Published on March 17, 2013
Default avatar

By Bulat Khamitov

How To Install VirtualBox on CentOS 6.3 x64

Status: Deprecated

This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.

Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.

Step 1 - Installation

yum -y groupinstall Desktop
yum -y install qt qt-devel SDL-devel tigervnc-server gcc make kernel-devel
export KERN_DIR=/usr/src/kernels/2.6.32-358.2.1.el6.x86_64
rpm -ivh http://download.virtualbox.org/virtualbox/4.2.10/VirtualBox-4.2-4.2.10_84104_el6-1.x86_64.rpm
/etc/init.d/vboxdrv setup

Step 2 - Set VNC Server

vncpasswd

Add these two lines to /etc/sysconfig/vncservers :

VNCSERVERS="0:root"
VNCSERVERARGS[0]="-geometry 1024x768"

If you do not want to run VNC as user root, and would like to create an encrypted tunnel, create a separate user, and add -localhost to VNCSERVERARGS above.

You would then have to create a tunnel using Putty or some other SSH client, and map localhost:port -> localhost:5901 tunnel, and restart vncserver service for changes to take effect.

Step 3 - Start VNC Server

service vncserver start

Step 4 - Download TightVNC Viewer and connect to your droplet's IP port 5900.

When connecting with TightVNC Viewer, remote host address would be in IP::PORT format:

Enter Your VNC Password from Step 2 above:

Step 5 - Upload your desired ISO Disk or Disk Image to be imported.

You can install any Linux / BSD / Windows OS with an uploaded ISO image.

If you have an existing Disk Image with filetypes such as VDI, VMDK, QCOW, or RAW, you can import them into VirtualBox.

Step 6 - Launch VirtualBox and Install Virtual Machines

Once you are connected via VNC, click Applications -> System Tools -> Oracle VM VirtualBox

Using VirtualBox, you can even install Windows operating system, but they will be limited to 1 CPU Core.

Here is Windows XP running in VirtualBox:

By Bulat Khamitov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors
Default avatar
Bulat Khamitov

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

What a headache this is, I have to manually type this setup into the console as you have no copy/paste function. I’m getting the error “no such file or directory found” when typing this line:

rpm -ivh http://download.virtualbox.org/virtualbox/4.2.10/VirtualBox-4.2-4.2.10_84104_el6-1.x86_64.rpm

Figured it out, the “e16” is an L not a 1, thanks to your font I got confused.

Now I’m getting the same error when entering the next line:

/etc/init.d/vboxdrv setup

Thanks

I got VNC but how to download virtualbox

** File: /var/log/vbox-install.log**

Makefile:185: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop. make KBUILD_VERBOSE=1 SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 CONFIG_MODULE_SIG= -C /usr/src/kernels/2.6.32-042stab116.1/ -j4 modules make[1]: warning: -jN forced in submake: disabling jobserver mode. test -e include/linux/autoconf.h -a -e include/config/auto.conf || (
echo;
echo " ERROR: Kernel configuration is invalid.“;
echo " include/linux/autoconf.h or include/config/auto.conf are missing.”;
echo " Run ‘make oldconfig && make prepare’ on kernel src to fix it.";
echo;
/bin/false) mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/* make -f scripts/Makefile.build obj=/tmp/vbox.0 gcc -Wp,-MD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/s$ gcc -Wp,-MD,/tmp/vbox.0/.SUPDrv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/src/kernels/2$ gcc -Wp,-MD,/tmp/vbox.0/.SUPDrvGip.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/src/kernel$ gcc -Wp,-MD,/tmp/vbox.0/.SUPDrvSem.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/src/kernel$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/SUPDrvSem.o”; gcc -Wp,-MD,/tmp/vbox.0/.SUPDrvTracer.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/src/ker$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/linux/SUPDrv-linux.o”; gcc -Wp,-MD,/tmp/vbox.0/.SUPLibAll.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/src/kernel$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/SUPLibAll.o”; gcc -Wp,-MD,/tmp/vbox.0/r0drv/.alloc-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/sr$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/SUPDrvGip.o”; gcc -Wp,-MD,/tmp/vbox.0/r0drv/.initterm-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/SUPDrv.o”; set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/SUPDrvTracer.o”; gcc -Wp,-MD,/tmp/vbox.0/r0drv/.memobj-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi -I/usr/s$ gcc -Wp,-MD,/tmp/vbox.0/r0drv/.mpnotification-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/uapi $ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/r0drv/initterm-r0drv.o”; gcc -Wp,-MD,/tmp/vbox.0/r0drv/.powernotification-r0drv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/ua$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/r0drv/alloc-r0drv.o”; gcc -Wp,-MD,/tmp/vbox.0/r0drv/linux/.assert-r0drv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/u$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/r0drv/powernotification-r0drv.o”; gcc -Wp,-MD,/tmp/vbox.0/r0drv/linux/.alloc-r0drv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include -Iinclude -I/usr/src/kernels/2.6.32-042stab116.1/include/ua$ set -e ; perl /usr/src/kernels/2.6.32-042stab116.1/scripts/recordmcount.pl “x86_64” “64” “objdump” “objcopy” “gcc” “ld” “nm” “” “” “1” “/tmp/vbox.0/r0drv/memobj-r0drv.o”;

I made a mistake on my previous reply. Here is the correnct set of steps:

My solution to this problem was to do the following:

  1. Go to the followning folder to find out the environment name: [root@localhost ~]$ ls /usr/src/kernels 2.6.32-431.5.1.el6.x86_64

  2. Open the root “.bashrc” file for editing with Nano. [root@localhost ~]$ nano .bashrc

  3. The output from the command for the 1st step was used to insert a line in the “.bashrc” file. Inside of the file I added the following line: export KERN__DIR=/usr/src/kernels/2.6.32-431.5.1.el6.x86_64

  4. After saving the file I executed the “.bashrc” lines. [root@localhost ~]$ source .bashrc

  5. Finally I ran the VirtualBox rebuilding script: [root@localhost ~]$ /etc/init.d/vboxdrv setup

unlink: cannot unlink `/usr/src/kernels/2.6.32-431.11.2.el6.x86_64/lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build’: No such file or directory

or what did you mean?

i did then ln -s /usr/src/kernels/2.6.32-431.11.2.el6.x86_64/lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build/ ln: creating symbolic link `./build’: File exists

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-431.1.2.0.1.el6.x86_64 cannot be found at /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build or /lib/modules/2.6.32-431.1.2.0.1.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@test ~]#

[root@~]# /etc/init.d/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-431.1.2.0.1.el6.x86_64 cannot be found at /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build or /lib/modules/2.6.32-431.1.2.0.1.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@

BAD ln: [root@~]# ls -al /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64 total 3544 drwxr-xr-x 8 root root 4096 May 6 00:55 . dr-xr-xr-x 5 root root 4096 Apr 9 16:42 … lrwxrwxrwx 1 root root 54 Dec 17 18:30 build -> …/…/…/usr/src/kernels/2.6.32-431.1.2.0.1.el6.x86_64

unlink and add:

ln -s /usr/src/kernels/2.6.32-431.11.2.el6.x86_64 /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build

and go:

[root@2.6.32-431.1.2.0.1.el6.x86_64]# service vboxdrv setup Stopping VirtualBox kernel modules [ OK ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] [ OK ] Starting VirtualBox kernel modules [ OK ] [root@testsanfra 2.6.32-431.1.2.0.1.el6.x86_64]#

Hi Kamal.

The answers from the prompt is: Package matching kernel-headers-2.6.32-431.1.2.0.1.el6.x86_64 already installed. Checking for update. Nothing to do

After, he shows me that failed again.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
April 4, 2014

@mf.wagner: Try installing it through yum instead: <pre>sudo yum install kernel-headers-2.6.32-431.1.2.0.1.el6.x86_64 /etc/init.d/vboxdrv setup</pre>

Hi,

I try install on CentOS 6.3. Not work too. I point Kern_DIR to:

“export KERN_DIR=/usr/src/kernels/2.6.32-358.2.1.el6.x86_64” like tutorial describe, but I realize that on /var/log/vbox-install.log the problem described is that KERN directory is different, I put command prompt:

uname -r

and the return is: 2.6.18-348.16.1.el5.028stab108.1 that is not equal the kernel mentioned on the tutorial. Now the challenge is to made both equal I think.

In the /var/log/vbox-install.log he show me:

Makefile:190: *** Error: KERN_DIR does not point to a directory. Stop. Makefile:190: *** Error: KERN_DIR does not point to a directory. Stop.

Hi Kamal,

Thanks for fast reply. Unfortunately not worked. The same result.

[root@mydroplet ~]# wget http://ftp.muug.mb.ca/mirror/centos/6.5/updates/x86_64/Packages/kernel-devel-2.6.32-431.1.2.0.1.el6.x86_64.rpm –2014-04-03 16:29:19-- http://ftp.muug.mb.ca/mirror/centos/6.5/updates/x86_64/Packages/kernel-devel-2.6.32-431.1.2.0.1.el6.x86_64.rpm Resolving ftp.muug.mb.ca… 130.179.31.46 Connecting to ftp.muug.mb.ca|130.179.31.46|:80… connected. HTTP request sent, awaiting response… 301 Moved Permanently Location: http://www.muug.mb.ca/mirror/centos/6.5/updates/x86_64/Packages/kernel-devel-2.6.32-431.1.2.0.1.el6.x86_64.rpm [following] –2014-04-03 16:29:19-- http://www.muug.mb.ca/mirror/centos/6.5/updates/x86_64/Packages/kernel-devel-2.6.32-431.1.2.0.1.el6.x86_64.rpm Resolving www.muug.mb.ca… 130.179.31.46 Reusing existing connection to ftp.muug.mb.ca:80. HTTP request sent, awaiting response… 200 OK Length: 9193792 (8.8M) [application/x-rpm] Saving to: `kernel-devel-2.6.32-431.1.2.0.1.el6.x86_64.rpm’

100%[===================================================================================================================================>] 9,193,792 7.55M/s in 1.2s

2014-04-03 16:29:20 (7.55 MB/s) - `kernel-devel-2.6.32-431.1.2.0.1.el6.x86_64.rpm’ saved [9193792/9193792]

[root@freshemail ~]# /etc/init.d/vboxdrv setup Stopping VirtualBox kernel modules [ OK ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Removing old VirtualBox pci kernel module [ OK ] Removing old VirtualBox netadp kernel module [ OK ] Removing old VirtualBox netflt kernel module [ OK ] Removing old VirtualBox kernel module [ OK ] Trying to register the VirtualBox kernel modules using DKMSError! echo Your kernel headers for kernel 2.6.32-431.1.2.0.1.el6.x86_64 cannot be found at /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build or /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/source. [FAILED] (Failed, trying without DKMS) Recompiling VirtualBox kernel modules [ OK ] Starting VirtualBox kernel modules [ OK ]

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel