My centos is a virtual machine using virtualbox. After installation, it is best to install the vboxadditions enhancement function. The main purpose is to share files between the virtual machine and the host machine.
1. Update the kernel. The default kernel for centos 6.2 Is 2.6.32-220. el6:
#Uname-R2.6.32-220. El6.x86 _ 64
The kernel-devel package is required to install the enhancement feature. Ensure that the kernel-devel and kernel versions are consistent. View the kernel-devel version in the software source:
] # Yum Info Kernel- Develloaded plugins: fastestmirror, refresh - Packagekit, securityloading mirror speeds from cached hostfile * Epel: mirrors.ustc.edu.cn *Rpmforge: pai.oscc.org. myavailable packagesname: Kernel - Develarch: x86_64version: 2.6 . 32 Release: 279.5 . 2 . El6size: 7.6 Mrepo: updatessummary: Development Package For Building kernel modules to match the: kernelurl: http: // Www.kernel.org/ License: gplv2description: this package provides kernel headers and makefiles sufficient to: build modules against the kernel package.
The current kernel-devel version is 2.6.32-279.5.2.e16. Therefore, you must upgrade the kernel:
# Yum update Kernel
After the upgrade, you must restart the system to use the new kernel.
2. Install kernel-devel and GCC.
# YumInstallKernel-develGcc Gcc-C ++
3. Install the enhancement feature. Go to the root directory of the enhancement disc and run the installation command in Linux:
#./ Vboxlinuxadditions. Run verifying archive integrity... all good. Uncompressing virtualbox 4.1 .18 Guest Additions For Linux ...... virtualbox guest additions installerremoving existing virtualbox dkms kernel modules [OK] removing existing virtualbox non - Dkms kernel modules [OK] building the virtualbox guest additions kernel modulesbuilding the main guest additions module [OK] building the shared folder support module [OK] building the OpenGL support module [failed] (look at /Var/log/vboxadd- Install . Log Find Out what went wrong) doing non -Kernel setup of the guest additions [OK] installing the window system driversinstalling X. org Server 1.10 Modules [OK] setting up the window system to use the guest additions [OK] You may need to restart the Hal service and the window system (or just restartthe Guest System) to enable the guest additions. installing graphics libraries and desktop services componen [OK]
An error may occur when installing vboxlinuxadditions:
$./Vboxlinuxadditions.Run
... Building the main guest additions module [failed] (look/Var/Log/Vboxadd-install.LogTo find out what went wrong )......
$ Cat/Var/Log/Vboxadd-install.Log/Tmp/vbox.0/Makefile. Include. header:97: *** Error: unable to find the sources of your current Linux kernel. Specify kern_dir = <directory> and run make again. Stop.Creating userForThe guest additions.Creating udev ruleForThe guest additions kernel module.
It may be caused by inconsistent kernel directories and kernel versions:
$ Ls/usr/src/kernels/2.6.32-358.6.2. El6.X86_64 $ uname-R2.6.32-358. El6.x86 _ 64
Setting up a link pointing to the kernel directory should solve the problem:
$ LS-L/usr/src/kernels/ Total 4 Drwxr -XR -X . 22 Root 4096 May 24 17 : 39 2.6 . 32 - 358.6 . 2 . El6. X86_64lrwxrwxrwx . 1 Root 42 May 24 17 : 38 2.6 . 32 -358 . El6.x86 _ 64->/usr/src/kernels/ 2.6 . 32 - 358.6 . 2 . El6.x86 _ 64