営業が勉強するプログラミング

現在は動画配信の企画&営業&フィールドSEみたいなことをやっております。

【初心者が行う】vagrant上にcentos7を構築

環境

設定

  • ここより目的のboxファイルを探す。
  • 今回はcentos7なので下記のようなコマンドを実行
    • コマンドのcentos7は任意のbox名となります。わかりやすいように適当につける。
vagrant box add centos7 https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box
  • box listで今ダウンローしたものを確認
vagrant box list
centos7 (virualbox, 0)
  • カレントディレクトリで下記のコマンドで初期化して、「Vagrantfile」を作る
vagrant init centos7
  • 下記のコマンドで、centos7を起動!
vagrant up

これで行けると思ったら、エラーが!!!

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

ググると、ここにあるように「共有領域がマウントできない」と入れているようでした。

で、同じように再セットアップをしました。

$ vagrant ssh
$ sudo /etc/init.d/vboxadd setup

Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module                   [  OK  ]
Building the shared folder support module                  [  OK  ]
Building the OpenGL support module                         [  OK  ]
Doing non-kernel setup of the Guest Additions              [  OK  ]
Starting the VirtualBox Guest Additions                    [  OK  ]

という感じになり、Vagrantのhalt、upを行いエラーが出ないことを確認しました。

これでcentos7の構築完了。あとは、各種設定ですね。 またこれについては記載しようと思います。