VagrantでCentOS 7でXdebugでデバッグ 準備編


VagrantVirtualBoxがインストール済みWindowsという前提。Macはコマンド プロンプトとGit Bashを無視して全てターミナルでやって下さい。

まずは適当なフォルダを作り、コマンド プロンプトでそのフォルダに移動。下記コマンドを入力。bento/centos-7.1はVagrantの開発元がやってるサイトに置いてあるboxです。

vagrant init bento/centos-7.1

下記と似たとこを探し、それぞれ追記して保存。IPアドレスは適当に変更。 :public_network, ip: ""
  config.vm.synced_folder "html/", "/var/www/html"



vagrant up

Git Bashがあれば開いて

vagrant ssh



sudo yum -y update

アップデート終了後、コマンド プロンプトで

vagrant reload


GuestAdditions seems to be installed (5.0.6) correctly, but not running.
Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]
bash: line 3: vboxadd: command not found
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-3.10.0-327.4.5.el7.x86_64

Building the main Guest Additions module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions[  OK  ]
Restarting VM to apply changes...


Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

そうしましたら、再度、Git Bashなどで仮想マシンにログインして

sudo yum install -y gcc kernel-devel


sudo /sbin/rcvboxadd setup


先ほどと同じ手順でvagrant reloadして仮想マシンにログイン。これで最新のCentOS、今日だとバージョン7.2.1511のセットアップが完了です。今日はここまで。