Vagrant: установка на OS X

Автор: | 20/10/2015
 

vagrant-logo_7acd1165e16d4120b62515fa57fe29beЗадача: установить Vagrant на Mac OS.

Что такое Vagrant и как его использовать – в следующий раз, в данном посте – установка и первый запуск бокса.

Операционная система:

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: OS X 10.10.5 (14F27)
      Kernel Version: Darwin 14.5.0
      ...

Провайдером для Vagrant будет VirtualBox.

Устанавливаем:

# brew cask install virtualbox

Устанавливаем сам Vagrant:

# brew cask install vagrant

Менеджер для управления машинами, при желании:

# brew cask install vagrant-manager

Проверяем:

# vagrant -v
Vagrant 1.7.4

Создадим временный каталог для проверки:

# mkdir -p /tmp/vagrant
# cd /tmp/vagrant

Создаём новую машину:

# vagrant init ubuntu/trusty64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

И запускаем её:

# vagrant up --provider virtualbox
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
...
    default: VirtualBox Version: 5.0
...

Проверяем – подключаемся к новой машине по SSH:

# vagrant ssh
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-65-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Oct 19 12:58:13 UTC 2015

  System load:  0.92              Processes:           82
  Usage of /:   2.9% of 39.34GB   Users logged in:     0
  Memory usage: 21%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


vagrant@vagrant-ubuntu-trusty-64:~$

Готово.