Sunday 12 April 2015

Vagrant: Why and how



Why I am using Vagrant?


  • Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.

  • Using the vagrantFile, the project developers are able to run the code in the same environment, against the same dependencies, all configured the same way.




Purpose of Vagrantfile :



  • Mark the root directory of your project. A lot of the configuration of Vagrant is relative to this root directory.

  • Describe the kind of machine and resources you need to run your project, as well as what software to install and how you want to access it.

How to build Vagrant?


  • Make sure your system is updated. Since I was earlier using Kubuntu 13.04 which is not supported by vagrant, I upgraded Kubuntu 13.04 to Kubuntu 13.10 to Kubuntu 14.04 to be able to run it

  • Check your system and download vagrant through this link 

  • Perform the following bash commands :
$ mkdir vagrant_directory
$cd vagrant_directory
$vagrant init
$vagrant box add ubuntu/trusty64


  • Now, open the vagrantFile and do the following :

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64
  • Now, open and terminal and do the following :
$vagrant up 
To prove that it is running, you can SSH into the machine:
$ vagrant ssh
To access the vagrantfile of my system, visit github: fallacy321/vagrant

To have a look at my terminal : pastebin 


No comments:

Post a Comment

Enter your text here .....