如何?它给出了一个错误。
[vagrant@localhost mnt]$ sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.16 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.16 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
Failed to set up service vboxadd, please check the log file
/var/log/VBoxGuestAdditions.log for details.
[vagrant@localhost mnt]$ cat /var/log/VBoxGuestAdditions.log
vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed..
[vagrant@localhost mnt]$ 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.
Run Code Online (Sandbox Code Playgroud)
vagrant init centos/7
vagrant up; vagrant halt
Run Code Online (Sandbox Code Playgroud)
VBoxGuestAdditions.iso要插入驱动器的文件。vagrant和路径指向您的Vagrantfile. Vagrant 未正确设置 /vagrant。编辑Vagrantfile并将其添加到底部以在每次启动时配置共享文件夹。
config.vm.provision "shell", run: "always", inline: <<-SHELL
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
SHELL
Run Code Online (Sandbox Code Playgroud)继续
vagrant up
vagrant ssh
sudo yum update
sudo yum install kernel-devel gcc
exit
vagrant halt; vagrant up; vagrant ssh
export KERN_DIR=/usr/src/kernels/`uname -r`
sudo mount /dev/sr0/ /mnt
cd /mnt
sudo ./VBoxLinuxAdditions.run
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
21141 次 |
| 最近记录: |