Como instalo adições de convidados do VirtualBox para o CentOS 7?

5

Como? Isso dá um erro.

[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.
    
por Chloe 06.04.2017 / 03:06

2 respostas

1
vagrant init centos/7
vagrant up; vagrant halt
  • Adicione um CDROM à máquina virtual e selecione o arquivo VBoxGuestAdditions.iso para inserir na unidade.

  • AdicionemanualmenteumapastacompartilhadanoVirtualBoxcomonomevagranteocaminhoparaodiretóriodeseuVagrantfile.OVagrantnãoconfigura/vagrantcorretamente.

  • EditeVagrantfileeadicioneissoaofinalparaprovisionarapastacompartilhadatodavezquevocêiniciar.

    config.vm.provision"shell", run: "always", inline: <<-SHELL
        mount -t vboxsf -o uid='id -u vagrant',gid='id -g vagrant' vagrant /vagrant
    SHELL
    
  • Continue com

    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
    
por 06.04.2017 / 03:06
1
$ 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.

Seu arquivo install.log é muito claro: você precisa instalar os cabeçalhos,

sudo yum update
sudo yum install kernel-headers kernel-devel

e, em seguida, você pode reinstalar o VirtualBox.

    
por 07.04.2017 / 07:13