VitualBoxでGuest Addonをインストールする
CentOS 7.4 最小構成時だとインストールできなかったのでメモ
結論から言うと以下を入れてから実行すればよい(インストール後に要再起動)
# yum install bzip2 gcc make perl kernel-devel
失敗例
インストールに失敗するとこんな感じになります
# ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 5.2.1 Guest Additions for Linux........ VirtualBox Guest Additions installer Copying additional installer modules ... ./install.sh: 行 371: bzip2: コマンドが見つかりません tar: これは tar アーカイブではないようです tar: 前のエラーにより失敗ステータスで終了します ./install.sh: 行 384: bzip2: コマンドが見つかりません tar: これは tar アーカイブではないようです tar: 前のエラーにより失敗ステータスで終了します # ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 5.2.1 Guest Additions for Linux........ VirtualBox Guest Additions installer This system appears to have a version of the VirtualBox Guest Additions already installed. If it is part of the operating system and kept up-to-date, there is most likely no need to replace it. If it is not up-to-date, you should get a notification when you start the system. If you wish to replace it with this version, please do not continue with this installation now, but instead remove the current version first, following the instructions for the operating system. If your system simply has the remains of a version of the Additions you could not remove you should probably continue now, and these will be removed during installation. Do you wish to continue? [yes or no] yes 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 gcc make perl packages from your distribution. 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.el7.x86_64 VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This system is currently not set up to build kernel modules. Please install the gcc make perl packages from your distribution. 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.el7.x86_64
導入手順
先ほどのパッケージを入れたうえで、Guest Addons CDをマウントして実行するだけです。
●パッケージのインストール(要再起動) # yum install -y bzip2 gcc make perl kernel-devel # reboot ●ISOのマウント # mount -t iso9660 -o loop,ro /dev/sr0 /mnt/ ●インストーラの実行 # cd /mnt/ # ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 5.2.1 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. VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted VirtualBox Guest Additions: Starting.
(参考)GuestAddonを削除する
インストール時に用いたスクリプトの引数にuninstallを与えれば削除できます。
# ./VBoxLinuxAdditions.run uninstall Verifying archive integrity... All good. Uncompressing VirtualBox 5.2.1 Guest Additions for Linux........ VirtualBox Guest Additions installer Removing installed version 5.2.1 of VirtualBox Guest Additions..