CentOS實驗九:安裝VBoxAdditions

來源:互聯網
上載者:User

我的CentOS是用VirtualBox做的虛擬機器,安裝好以後最好再將VBoxAdditions增強功能裝上,主要目的是能夠在虛擬機器和宿主機之間能夠共用檔案。

1. 更新核心。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.32Release     : 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.

當前的kernel-devel版本是2.6.32-279.5.2.e16。因此,必須升級kernel:

# yum update kernel

升級完後必須重啟系統,新的kernel才能被使用。

 

2. 安裝kernel-devel和gcc。

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

 

3. 安裝增強功能。進入增強功能光碟片根目錄,執行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 -r2.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
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.