LoginSignup
1

More than 5 years have passed since last update.

vagrant起動までの最短メモ

Last updated at Posted at 2017-01-27

VirtualBoxとVagrantをDL

OSに合ったVirtualBoxをダウンロードしてインストール
https://www.virtualbox.org/wiki/Downloads

OSに合ったVagrantをダウンロードしてインストール
https://www.vagrantup.com/downloads.html

設定

boxファイルをDLする
vagrant box add {VM名} {boxファイルダウンロードURL}

ubuntu14.4
https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/14.04/ubuntu-14.04-amd64.box
cent os
vagrant box add centos6-7 https://github.com/CommanderK5/packer-centos-template/releases/download/0.6.7/vagrant-centos-6.7.box
その他
http://www.vagrantbox.es/

DLされたか確認
vagrant box list

初期化
vagrant init [listで確認したOSのバージョン]

vagrant起動

vagrant up

ssh接続
vagrant ssh

起動完了

エラーが出た場合

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' 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 'base' (v0) for provider: virtualbox
    default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/***/vagrant/base

initが間違ってる可能性が高い。
一度消して再度入れ直す。
rm Vagrantfile
vagrant init CentOS7
vagrant up

vagrantコマンド一覧

vagrant box add {VM名} {boxファイルダウンロードURL}  box追加
vagrant box list    利用可能box一覧確認
vagrant box remove {box名} boxの削除
vagrant init    vagrant 初期化(Vagrantfileの作成)
vagrant up  vagrant 起動
vagrant ssh vagrant ログイン
vagrant halt    vagrant 終了
vagrant reload  vagrant リロード(halt + up)
vagrant destroy vagrant 破棄

参考

http://qiita.com/Esfahan/items/41c4469f28f6011ab33b
https://inexio.jp/20150707-944/
http://qiita.com/croissant1028/items/1cd808dd8cc2b27044ef

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1