"Vagrant"의 두 판 사이의 차이

오픈소스 비즈니스 컨설팅
둘러보기로 가기 검색하러 가기
82번째 줄: 82번째 줄:
  
 
Snapshot
 
Snapshot
  vagrant snapshot save                                      #--- Snapshot 생성
+
vagrant snapshot push
 +
vagrant snapshot pop
 +
 +
  vagrant snapshot save ${name}                              #--- Snapshot 생성
 +
vagrant snapshot restore ${name}                            #--- Snapshot으로 복구
 +
vagrant snapshot list                                       #--- Snapshot 목록 조회
  
 
== 참고문헌 ==
 
== 참고문헌 ==

2018년 9월 1일 (토) 09:20 판

Vagrant는 간소화된 가상머신(VM, Virtual Machine) 관리 서비스 이다.

  • 라이선스 : Mit License
  • 플랫폼 : Ruby

Vagrant 개요

Vagrant 용어

  • Box : 기본 설정을 가진 VM Template Image

Vagrant 설치

CentOS6에 Vagrant 설치

#--- https://releases.hashicorp.com/vagrant/
#--- yum -y install vagrant
rpm -ivh https://releases.hashicorp.com/vagrant/2.1.4/vagrant_2.1.4_x86_64.rpm

vagrant -v 
vagrant --help

VM 관리

CentOS 7 관리

mkdir -p /work/vagrant/CentOS7
cd /work/vagrant/CentOS7

#--- CentOS 7 설치를 위한 Vagrantfile을 생성 한다.
vi Vagrantfile
   Vagrant.configure("2") do |config|
     config.vm.box = "centos/7"
     config.vm.network "forwarded_port", guest: 80, host: 8081
     config.vm.provider "virtualbox" do |vb|
         vb.name = "centos"
         vb.memory = "6144"
         vb.cpus = "6"
     end
   end
vagrant init [${box_name}]                                  #--- Vagrantfile로부터 생성되는 환경 초기화
vagrant box list                                            #--- Vagrant Box 목록 조회

Ubuntu 18.04.1 LTS 관리

mkdir -p /work/vagrant/Ubuntu18
cd /work/vagrant/Ubuntu18

#--- Ubuntu 18.04.1 LTS 설치를 위한 Vagrantfile을 생성 한다.
vi Vagrantfile
   Vagrant.configure("2") do |config|
     config.vm.box = "ubuntu/xenial64"
     config.vm.network "forwarded_port", guest: 80, host: 8080
     config.vm.provider "virtualbox" do |vb|
         vb.name = "ubuntu"
         vb.memory = "6144"
         vb.cpus = "6"
     end
   end
vagrant init [${box_name}]                                  #--- Vagrantfile로부터 생성되는 환경 초기화
vagrant box list                                            #--- Vagrant Box 목록 조회

VM 관리

vagrant up                                                  #--- CentOS 7 startup
vagrant reload                                              #--- 변경된 Vagrantfile 적용
vagrant halt                                                #--- CentOS 7 shutdown
vagrant destroy -f                                          #--- CentOS 7 shutdown & destroy

vagrant status                                              #--- 상태 조회

#--- ssh 127.0.0.1:2222, vagrant / vagrant
#---    port는 vagrant up시 표시되는 메시지에서 확인할 것
vagrant ssh                                                 #--- CentOS 7에 ssh로 접속

Snapshot

vagrant snapshot push
vagrant snapshot pop

vagrant snapshot save ${name}                               #--- Snapshot 생성
vagrant snapshot restore ${name}                            #--- Snapshot으로 복구
vagrant snapshot list                                       #--- Snapshot 목록 조회

참고문헌