虛擬機 virtualbox, 安裝操作系統centos6.5
報錯信息如下:
$ sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.Uncompressing VirtualBox 5.0.24 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.24 of VirtualBox Guest Additions...
Stopping VirtualBox Additions [ OK ]
Removing existing VirtualBox non-DKMS kernel modules [確定]
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [確定]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.el6.x86_64
Building the main Guest Additions module [失敗]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions [確定]
$ 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。 停止。
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
解決方法:
1)安裝 gcc make gcc-c++
#yum install gcc make gcc-c++
2)安裝kernel-headers kernel-devel#yum install kernel-headers kernel-devel
3)、如果還不行,就把centos所有包升級下
#yum update4)、重啓
#reboot5)、重新安裝
# mount -t auto /dev/cdrom /mnt/cdrom
#sh ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.24 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.24 of VirtualBox Guest Additions...
Stopping VirtualBox Additions [ OK ]
Removing existing VirtualBox non-DKMS kernel modules [確定]
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [確定]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module [確定]
Building the shared folder support module [確定]
Building the graphics driver module [確定]
Doing non-kernel setup of the Guest Additions [確定]
Starting the VirtualBox Guest Additions Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping. [確定]
PS:訪問共享文件夾
- mkdir /mnt/share 新建掛載點(mountpoint)
- mount -t vboxsf mysharedir /mnt/share 掛載共享文件夾 ------------------mysharedir 是虛擬機中設置的共享文件夾名稱
- cd /mnt/share 進入共享文件夾
- ls 看看有什麼