반응형

1. http://www.vagrantup.com/downloads 에서 다운로드 후 설치

# cd /usr/local/src

# rpm -ivh vagrant_1.7.4_x86_64.rpm 

# /opt/vagrant/bin/vagrant -v

Vagrant 1.7.4


2. http://virtualbox.org에서 다운로드 후 설치

# sh VirtualBox-5.0.10-104061-Linux_amd64.run


3. http://www.vagrantbox.es/에서 원하는 이미지 파일 확인


4. 생성

4.1) Single Node - 이미지 CentOS 6.6 x64 설치 후 실행

# pwd

/usr/local/Vagrant/single


### vagrant box add {title} {url}

# vagrant box add CentOS_6.6_x64_vagrant https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.0.0/centos-6.6-x86_64.box

==> box: Box file was not detected as metadata. Adding it directly...

==> box: Adding box 'CentOS_6.6_x64_vagrant' (v0) for provider: 

    box: Downloading: https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.0.0/centos-6.6-x86_64.box

==> box: Successfully added box 'CentOS_6.6_x64_vagrant' (v0) for 'virtualbox'!


### vagrant init {title}

# vagrant init CentOS_6.6_x64_vagrant

# vagrant up

Bringing machine 'default' up with 'virtualbox' provider...

==> default: Importing base box 'CentOS_6.6_x64_vagrant'...

==> default: Matching MAC address for NAT networking...

==> default: Setting the name of the VM: single_default_1448415772803_55432

==> default: Clearing any previously set forwarded ports...

==> default: Fixed port collision for 22 => 2222. Now on port 2203.

==> default: Clearing any previously set network interfaces...

==> default: Preparing network interfaces based on configuration...

    default: Adapter 1: nat

==> default: Forwarding ports...

    default: 22 => 2203 (adapter 1)

==> default: Booting VM...

==> default: Waiting for machine to boot. This may take a few minutes...

    default: SSH address: 127.0.0.1:2203

    default: SSH username: vagrant

    default: SSH auth method: private key

    default: Warning: Connection timeout. Retrying...

    default: 

    default: Vagrant insecure key detected. Vagrant will automatically replace

    default: this with a newly generated keypair for better security.

    default: 

    default: Inserting generated public key within guest...

    default: Removing insecure key from the guest if it's present...

    default: Key inserted! Disconnecting and reconnecting using new SSH key...

==> default: Machine booted and ready!

==> default: Checking for guest additions in VM...

    default: The guest additions on this VM do not match the installed version of

    default: VirtualBox! In most cases this is fine, but in rare cases it can

    default: prevent things such as shared folders from working properly. If you see

    default: shared folder errors, please make sure the guest additions within the

    default: virtual machine match the version of VirtualBox you have installed on

    default: your host and reload your VM.

    default: 

    default: Guest Additions Version: 4.3.28

    default: VirtualBox Version: 5.0

==> default: Mounting shared folders...

    default: /vagrant => /Users/kobic/Vagrant/single


# vagrant ssh

Last login: Sat May 30 12:27:44 2015 from 10.0.2.2

Welcome to your Vagrant-built virtual machine.

$ cat /etc/redhat-release

CentOS release 6.6 (Final)



4.2) Multi Node - 이미지 CentOS 6.6 x64 설치 후 실행

### VirtualBox 설정

VirtualBox > 환경설정 > 네트워크 > 호스트 전용 네트워크 > vboxnet2 추가

  => vboxnet2 = IPv4 : 192.168.58.0/24


# pwd

/usr/local/Vagrant/cluster


# vi Vagrantfile

VAGRANTFILE_API_VERSION = "2"


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|


  config.vm.define "master" do |master|

     master.vm.box = "CentOS_6.6_x64_vagrant"

     master.vm.network "private_network", ip: "192.168.58.100", virtualbox__hostonly: "vboxnet2"

  end


  config.vm.define "slave" do |slave|

     slave.vm.box = "CentOS_6.6_x64_vagrant"

     slave.vm.network "private_network", ip: "192.168.58.101", virtualbox__hostonly: "vboxnet2"

  end


end


# vagrant up

# vagrant ssh master

# vagrant ssh slave


# vagrant destroy  // 이미지 삭제



http://jessesnet.com/development-notes/2014/vagrant-virtual-machine-cluster


반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기