vagrantがあがらない

vagrantを使ってみようってんで昨日VritaulBoxをインストールしたのに続き、vagrantをダウンロードしてrpmでインストール。

インストール

ここからrpmをダウンロードしてインストール。ものはここにあります。使った環境はRHEL7なのでCentOSのものをダウンロード。
rpmでインストール。

# rpm -ivh vagrant_1.9.7_x86_64.rpm

動かしてみる

手順によるとまずVagrantfileをダウンロードしてupするとのこと。

$ vagrant init precise64 http://files.vagrantup.com/precise64.box
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

つづいてinitで起動。

$ vagrant up
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.

なんかエラーになった。言われたとおり、'VBoxManage --version'を叩いてみる。

$ VBoxManage --version
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (3.10.0-514.26.2.el7.x86_64) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.
5.1.26r117224

なんだかカーネルを再コンパイルしろとか不穏なことをいってる。とりえあず、/sbin/vboxconfigを叩いてみる。

$  sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

  yum install kernel-devel-3.10.0-514.26.2.el7.x86_64
(The last command may fail if your system is not fully updated.)
  yum install kernel-devel
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.
This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

  yum install kernel-devel-3.10.0-514.26.2.el7.x86_64
(The last command may fail if your system is not fully updated.)
  yum install kernel-devel

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.

ふーん、なんかkernel-develがないだけみたい。さいしょからそう言ってくれればいいのに。
ということでインストールする。

# yum install kernel-devel
読み込んだプラグイン:product-id, search-disabled-repos, subscription-manager
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ kernel-devel.x86_64 0:3.10.0-514.26.2.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
 Package         アーキテクチャー
                           バージョン               リポジトリー           容量
================================================================================
インストール中:
 kernel-devel    x86_64    3.10.0-514.26.2.el7      rhel-7-server-rpms     13 M

トランザクションの要約
================================================================================
インストール  1 パッケージ

総ダウンロード容量: 13 M
インストール容量: 34 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for rhel-7-server-rpms
kernel-devel-3.10.0-514.26.2.el7.x86_64.rpm                |  13 MB   00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告: RPMDB は yum 以外で変更されました。
  インストール中          : kernel-devel-3.10.0-514.26.2.el7.x86_64         1/1 
  検証中                  : kernel-devel-3.10.0-514.26.2.el7.x86_64         1/1 

インストール:
  kernel-devel.x86_64 0:3.10.0-514.26.2.el7                                     

完了しました!

無事インストールできたので、vboxconfigを叩く。

$  sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.

なんだかよさげ。

$ VBoxManage --version
5.1.26r117224

エラーもでなくなった。もういちどinitしてみる。

$ $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'precise64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'precise64' (v0) for provider: virtualbox
    default: Downloading: http://files.vagrantup.com/precise64.box
    default: Progress: 16% (Rate: 51633/s, Estimated time remaining: 0:11:41)ap2: STA 60:67:20:45:a4:0c WPA: group key handshake completed (RSN)
                                                                                                                                                ap2: STA dc:2b:2a:a6:5c:60 WPA: group key handshake completed (RSN)
==> default: Successfully added box 'precise64' (v0) for 'virtualbox'!
==> default: Importing base box 'precise64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: murata_default_1501217348709_10801
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...

なんかよさ気です。