龙空技术网

virtualbox增强包VboxAdditions的安装

有AI野心的电工和码农 126

前言:

目前咱们对“centos6dkms”大约比较注重,兄弟们都想要剖析一些“centos6dkms”的相关文章。那么小编也在网络上汇集了一些关于“centos6dkms””的相关文章,希望大家能喜欢,朋友们一起来了解一下吧!

Origin address:

这是一篇15年的文章,现在不知还有参考价值没?

我的CentOS是用VirtualBox做的虚拟机,安装好以后最好再将VBoxAdditions增强功能装上,主要目的是能够在虚拟机和宿主机之间能够共享文件。

更新内核

CentOS 6.2对应的kernel默认为2.6.32-220.el6:

# uname -r2.6.32-220.el6.x86_64

安装增强功能需要kernel-devel包,必须保证kernel-devel和kernel版本的一致

查看软件源中kernel-devel的版本:

# yum info kernel-develLoaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * epel: mirrors.ustc.edu.cn * rpmforge: mirror.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         :      : GPLv2Description : This package provides kernel headers and makefiles sufficient to            : build modules against the kernel package.

当前的kernel-devel版本是2.6.32-279.5.2.e16。

因此,必须升级kernel:

# yum update kernel

升级完后必须重启系统,新的kernel才能被使用。

安装kernel-devel和gcc

# yum install kernel-devel gcc gcc-c++

安装增强功能

进入增强功能光盘根目录,执行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 to 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  ]

安装VBoxLinuxAdditions可能会报错:

$ ./VBoxLinuxAdditions.run  ... ...Building the main Guest Additions module                   [FAILED](Look at /var/log/vboxadd-install.log to 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 user for the Guest Additions. Creating udev rule for the Guest Additions kernel module.

可能是内核目录内核版本不一致造成的:

$ ls /usr/src/kernels/2.6.32-358.6.2.el6.x86_64$ uname -r 2.6.32-358.el6.x86_64

建立一个链接指向内核目录应该就可以解决问题:

$ ls -l /usr/src/kernels/total 4drwxr-xr-x. 22 root root 4096 May 24 17:39 2.6.32-358.6.2.el6.x86_64lrwxrwxrwx.  1 root 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

标签: #centos6dkms