vagrant Getting started with vagrant Easiest way to have a virtual linux in just a few minutes (in 3 steps)


Example

Step 1.

In your host machine (Windows/Linux/OSX), create an empty dir my_project.

Step 2.

Create a file named Vagrantfile with this:

Vagrant.configure("2") do |config|
  config.vm.box = "gbarbieru/xenial" #An Ubuntu 16.04 based image
  config.vm.hostname = "my_project"
  config.vm.network :private_network, ip: "172.16.123.10"
end

Step 3.

Run your machine:

host$ vagrant up
host$ vagrant ssh
virtual$ cd /vagrant

Done!


Notes:

  • Maybe you want to assign another IP address.
  • If your host is Windows, maybe you want to ssh from putty. You can do so by ssh-ing to hostname 127.0.0.1 and port 2222. Username is vagrant and password is vagrant.