"Vagrant"의 두 판 사이의 차이

오픈소스 비즈니스 컨설팅
둘러보기로 가기 검색하러 가기
잔글
73번째 줄: 73번째 줄:
  
 
vagrant ssh
 
vagrant ssh
 
== Box 생성 ==
 
 
Virtualbox에서 CentOS 7.0을 설치 합니다.
 
 
vagrant 사용자를 생성 합니다.
 
 
&nbsp; &nbsp; groupadd wheel<br/>&nbsp; &nbsp; useradd &nbsp;-d /home/vagrant -m -g wheel vagrant&nbsp;
 
 
visudo 명령을 사용하여 sudo 권한을 설정 합니다.
 
 
&nbsp; &nbsp; ###&nbsp;vagrant ALL=(ALL) NOPASSWD:ALL<br/>&nbsp;&nbsp; &nbsp;%wheel &nbsp;ALL=(ALL) &nbsp;ALL<br/>&nbsp; &nbsp;&nbsp;%wheel &nbsp;ALL=(ALL) &nbsp;NOPASSWD: ALL
 
 
vagrant 사용자의 ssh key 설정을 합니다.
 
 
&nbsp;cd /home/vagrant &nbsp;<br/>&nbsp;mkdir -p .ssh<br/>&nbsp; ###&nbsp;wget --no-check-certificate [https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub] -O /home/vagrant/.ssh/authorized_keys<br/>&nbsp; curl -kL [https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub] > .ssh/authorized_keys<br/>&nbsp;&nbsp;chmod 0700 /home/vagrant/.ssh<br/>&nbsp;&nbsp;chmod 0600 /home/vagrant/.ssh/authorized_keys<br/>&nbsp; chown -R vagrant:wheel /home/vagrant/.ssh<br/>&nbsp; exit
 
 
###yum install openssh-server<br/>yum install rsync openssh-clients<br/>yum clean all
 
 
shotdown -h&nbsp;now
 
 
vagrant package --output centos70_64.box --base "CentOS 7.0"
 
 
 
 
참고 문헌
 
 
*http://www.arrow-web.co.uk/blog/2014/11/creating-vagrant-base-box-centos
 
*https://gist.github.com/mislav/de29f665bb0eae38fdd3
 
*http://adhoc.tistory.com/entry/Vagrant-Box-%EB%A7%8C%EB%93%A4%EA%B8%B0
 
  
 
== 참고문헌 ==
 
== 참고문헌 ==

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

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

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

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

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 up                                                  #--- CentOS 7 startup
vagrant reload                                   
vagrant halt                                                #--- CentOS 7 shutdown
vagrant destroy -f                                          #--- CentOS 7 shutdown & destroy
vagrant status                                              #--- 상태 조회

vagrant ssh                                                 #--- CentOS 7에 ssh로 접속

vagrant snapshot save                                       #--- Snapshot 생성

Ubuntu 18.04.1 LTS 관리

Vagrant 개요

Vagrant 용어

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


VM 생성

vagrant box add <name> <image>

-   ~/.vagrant.d/box/

mkdir project

cd project

vagrant init <name>

vagrant up

vagrant ssh

참고문헌