나만의 Cloud

Virtual box Vagrant

뭉탁거림 2015. 7. 9. 16:55

Vagrant는 Vagrantfile 이용해서 Config


0. mkdir vagrant : 작업 폴더 생성


# vagrant box add NAME URL

vagrant box add centos64 http://downloads.sourceforge.net/project/nrel-vagrant-boxes/CentOS-6.5-x86_64-v20140504.box?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnrel-vagrant-boxes%2Ffiles%2F&ts=1436418211&use_mirror=jaist


# vagrant init BOX_NAME

vagrant init centos64


1. vagrant init : Vagrantfile 을 만든다.

This will place a Vagrantfile in your current directory.


Box

virtual machine 의 Base Image 이다. 여러 프로젝트에서 box 를 공유해서 사용할수 있다


Vagrantfile 설정

vagrant up

vagrant reload --provision


2. vagrant box add chef/centos-6.5 

Added boxes can be re-used by multiple projects. Each project uses a box as an initial image to clone from, and never modifies the actual base image This means that if you have two projects both using the hashicorp/precise32 box we just added, adding files in one guest machine will have no effect on the other machine.



3. Vagrantfile 수정


Vagrant.configure("2") do |config|

  config.vm.box = "hashicorp/precise32"

end


4. vagrant up

In less than a minute, this command will finish and you'll have a virtual machine running 


vagrant destroy : up 에 적용됬던 내용들을 모두 지운다. box 를 지우는건 아니다.


set PATH=%PATH%;C:\Program Files (x86)\Git\bin\


5. vagrant ssh 


Vagrantfile 설정

vagrant up

vagrant reload --provision