VirtualBoxでは、VirtualBox Guest AdditionsというものをゲストOSにインストールすることで、vmをより便利に使用することができます。
Vagrant経由でVirtualBoxを使っている場合、 vagrant-vbguestというプラグインを使用することで、このVirtualBox Guest Additionsを自動インストールさせることができます。
プラグインのインストール
プラグインのインストールはvagrant plugin install
コマンドを使用します
$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.1.gem (100%)
Installed the plugin 'vagrant-vbguest (0.15.1)'!
Guest Additionsを自動インストールしてみる
vagrant-vbguestをインストールできたら、あとはvagrant up
するだけでOKです。以下のように起動中にVBoxGuestAdditions.isoが自動でマウントされて、Virtualbox Guest Additionsを自動インストールしてくれます。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' is up to date...
==> default: A newer version of the box 'centos/7' for provider 'virtualbox' is
...
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.2.8 - guest version is unknown
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.8 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-693.21.1.el7.x86_64
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
こちらもおススメ