virtualbox安裝centos 6之加強工具時,在錯誤日誌中會提示:unable to find the source of your current linux kernellinux
#sudo sh ./VBoxLinuxAdditions.run
提示失敗
Building the VirtualBox Guest Additions kernel modules [FAILED]
Your system does not seem to be set up to build kernel modules.
Look at /var/log/vboxadd-install.log to find out what went wrong.
Once you have corrected it, you can run /etc/init.d/vboxadd setup to build them.
#gedit /var/log/vboxadd-install.log 內容
Makefile:23: *** 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.
安裝GCC
#yum install gcc
# yum install gcc kernel-devel kernel-headers
重啓。
再次安裝VBoxLinuxAdditions,OK。
centos
注意須要以Root身份運行,不然會提示權限不夠。工具
即使按此操做依舊安裝失敗。繼續找緣由。ui
須要設置KERN_DIR環境變量spa
好吧,安裝的KERN版本爲2.6.32-358.23.2.el6.x86_64,但不知爲什麼系統變量即便設置爲如上目錄,Linux依舊尋找這個版本日誌
2.6.32-358.el6.x86_64
ci
試着將它複製一份,到2.6.32-358.el6.x86_64目錄,再次運行,安裝成功。!it