Vagrant作業メモ

・vagrantを利用してvboxを起動するまでメモ
・vboxやDocker,EC2(AWS)といったイメージの起動・停止・破棄を制御
 →つまりコンテナやVMのそれぞれ個別で持っている制御コマンドを
   vagrantを利用することで同じインターフェイスでやれるものと理解

install

公式からinstall
vagrant insatll
virtualbox install

vagrant

# vagrant --help
Usage: vagrant [options] <command> [<args>]

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Common commands:
     box             manages boxes: installation, removal, etc.
     connect         connect to a remotely shared Vagrant environment
     destroy         stops and deletes all traces of the vagrant machine
     global-status   outputs status Vagrant environments for this user
     halt            stops the vagrant machine
     help            shows the help for a subcommand
     init            initializes a new Vagrant environment by creating a Vagrantfile
     login           log in to HashiCorp's Atlas
     package         packages a running vagrant environment into a box
     plugin          manages plugins: install, uninstall, update, etc.
     port            displays information about guest port mappings
     powershell      connects to machine via powershell remoting
     provision       provisions the vagrant machine
     push            deploys code in this environment to a configured destination
     rdp             connects to machine via RDP
     reload          restarts vagrant machine, loads new Vagrantfile configuration
     resume          resume a suspended vagrant machine
     share           share your Vagrant environment with anyone in the world
     snapshot        manages snapshots: saving, restoring, etc.
     ssh             connects to machine via SSH
     ssh-config      outputs OpenSSH valid configuration to connect to the machine
     status          outputs status of the vagrant machine
     suspend         suspends the machine
     up              starts and provisions the vagrant environment
     version         prints current and latest Vagrant version

For help on any individual command run `vagrant COMMAND -h`

Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.

起動までの流れ

作業ディレクトリ

mkdir -p ./vagrant_work/centos6;cd ./vagrant_work/centos6

Vagrant init

vagrant init vagrant init scalefactory/centos6

→実行ディレクトリに「Vagrantfile」が生成される
Atlas Discover Vagrant Boxes

起動

実行ディレクトリに生成された「Vagrantfile」に合せて
仮想マシンが起動される

vagrant up

接続

vagrant ssh
TOP