Loading AI tools
From Wikipedia, the free encyclopedia
Vagrant is a computer software that creates and configures virtual development environments.[3] It can be seen as a higher-level wrapper around virtualization software such as VirtualBox, VMware, KVM and Linux Containers (LXC), and around configuration management software such as Ansible, Chef, Salt and Puppet.
This is not a Wikipedia article: It is an individual user's work-in-progress page, and may be incomplete and/or unreliable. For guidance on developing this draft, see Wikipedia:So you made a userspace draft. Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
It has been suggested that this page be merged into Vagrant (software). (Discuss) Proposed since May 2022. |
Original author(s) | Mitchell Hashimoto |
---|---|
Developer(s) | Mitchell Hashimoto and John Bender |
Initial release | March 8, 2010[1] |
Stable release | 1.7.4
/ July 17, 2015 } |
Written in | Ruby |
Operating system | Linux, FreeBSD, OS X, and Microsoft Windows |
Available in | English |
Type | Configuration management |
License | Mixed open-source and proprietary[2] |
Website | vagrantup |
Since version 1.1, Vagrant is no longer tied to VirtualBox and also works with other virtualization software such as VMware and KVM, and supports server environments like Amazon EC2.[4] Although written in Ruby, it is usable in projects written in other programming languages such as PHP, Python, Java, C# and JavaScript.[5][6]
Since version 1.6, Vagrant natively supports Docker containers, which serve as a substitute for a fully virtualized operating system. This reduces overhead as Docker uses lightweight Linux Containers.[7]
Vagrant plugins also exist, including vagrant-libvirt that adds support for libvirt, [8] vagrant-lxc that adds support for lxc, [9] and vagrant-vsphere that adds support for VMware's ESXi.[10]
The idea behind Vagrant started in 2009. Mitchell Hashimoto was frustrated building similar development environments for different projects when he was employed by Ruby development shops. He wanted a solution that would enable him to easily set up development environments for new projects and revert back to stable environment states.[11]
In January 2010, Mitchell approached his colleague, John Bender, who valued his idea and offered to join in on the project. Vagrant began with a project name "hobo". The first working prototype was built by January 31, 2010. This prototype loaded virtual machines and supported SSH commands. [11]
Vagrant 0.1.0 was released in March 8, 2010. Interestingly it was planned to release only supporting a single Ubuntu image but John Bender came up with the idea of "box" system about a week before its public release. Later on, this feature turned out to be one of the most critical pieces to Vagrant. Along with this release, Vagrant also launched its mascot named "Vince Chilling".[11]
After a few months from its first release, Carl Lerche, employee at Engine Yard, discovered Vagrant and proposed to offer sponsorship. On October 14, 2010 Engine Yard announced its sponsorship in an article titled "Mitchell Hashimoto Joins Engine Yard OSS Community Grant Program".[11][12]
In March 2012, the first stable version of Vagrant (v1.0) was released. But even before the release of Vagrant 1.0, hundreds of companies had already started using it including Mozilla, RackSpace, LivingSocial, Shopify, OpenStack, EventBrite. From the beginning, Vagrant had kept itself open sourced under the MIT license. [11]
In November 2012, Mitchell formed [HashiCorp] to back the development of Vagrant full-time. HashiCorp builds commercial additions and provides professional support and training for Vagrant. [13]
In January 2013, the new Vagrant logo: A simple "V" built with isometric cubes was launched, replacing its old mascot "Vince Chilling". [14]
Vagrant architecture consists of two layers: Core layer and Plugin layer.
The core layer consists of the most inner kernel of Vagrant which specifies the core component of the system such as machines. It also represents the interface to the actual virtual machine. The core layer is made up of components like box, vagrantfile, command line interface, provisoner, provider, and plugin.
Box is a packaged format of virtual machine in a Vagrant environment. It is a Vagrant compatible file which can be used by anyone on any system with Vagrant installed in it. Vagrant maintains a set of [predefined boxes] for public use. These boxes can also be customized as per user preference.[15] [16]
A vagrantfile is the central configuration of a Vagrant machine for the end-user. In this file all kinds of settings such as the provider and provisioner can be specified. If two users share the same vagrantfile, then the two users will possess the same configured Vagrant environment. [16]. Vagrant is meant to run with one vagrantfile per project and the vagrantfile is supposed to be committed to version control. This allows other developers involved in the project to check out the code and customize the vagrantfile as per the use. Code inside vagrantfile is written in Ruby. [17]
Vagrant provides the ability to sync up the Vagrant folder on different host machines. This enables the user to work on different host machines without the need to re-configure it. By default, Vagrant shares the project directory i.e. /Vagrants
. It uses NFS, Rsync, SMB, Virtual Box to enable syncing up of folders. [16][18][19][20][21][22]
Vagrant provides multi-machine feature which enables the user to setup Vagrant environment with multiple virtual machines. This configuration is done in vagrantfile, wherein the user can specify virtual machine instance and assign name to them. Setting up of multiple machines is of great use in following scenarios:
Providers are used to delegate communication with the virtualized instance. Vagrant, by default, gives support for Virtual Box. It also supports other types of machines such as Docker, Hypervisor, VMWare, etc. In order to use other type of machines, Vagrant has specific plugins developed for this purpose. [16] [24]
Provisioner helps the user to install the software and configure the machine as per the user customization. This helps the user to further customize the boxes as per requirement, as the predefined boxes typically aren't built perfectly for the user requirement.[16] [25]
Vagrant implements most of the additional functionality via plugins. Since Vagrant dogfoods its own plugin API, one can be confident that the interface is stable and well supported. One such plugin is called Vagrant-AWS, which allows Vagrant to control and provision Vagrant machines in EC2 and VPC. [16] [26][27]
In order to set up Vagrant, we create a vagrantfile. This file serves as a root directory of the project and also contains the specifics of the kind of machine and resources needed to run the project. [28]
Vagrant has a built-in command for initializing a directory.
Create a working directory
$ mkdir vagrant_getting_started
Change the directory to the one created above
$ cd vagrant_getting_started
Fire the vagrant init command
$ vagrant init
Once the vagrantfile is created, Vagrant needs to add the boxes in order to run the virtual machine instance. Vagrant provides a list of [predefined boxes].
This command adds the box named precise32 to the Vagrant environment.
$ vagrant box add hashicorp/precise32
After the box has been added to Vagrant, the vagrantfile needs to be changed as shown below.
vi vagrantfile
Add the following Ruby code. Press i
to insert text and esc
followed by typing :wq
to save and quit.
Vargrant.configure("2") do |config| config.vm.box = "hashicorp/precise32" end
Once the box has been added and mentioned in the vagrantfile, the box can be booted with the following command.
$ vagrant up
Since Vagrant doesn't run a UI, the connection to the virtual machine instance is made using SSH protocol.
$ vagrant ssh
Vagrant allows developers to isolate dependencies and their configuration within a single disposable, consistent environment. The vagrantfile consists list of tools that should be installed into the boxes. With the help of the command vagrant up
everything gets installed and configured for others to work in development environments of same configuration. Vagrant also works on different platforms like Linux, Mac OS X and Windows. [29]
Vagrant provides an operations engineer a disposable environment and consistent workflow for developing and testing infrastructure management scripts. It facilitates testing of shell scripts, Chef cookbooks, Puppet modules and more using local virtualization such as VirtualBox or VMWare. Moreover, with the same configuration, testing of scripts on remote clouds such as AWS or RackSpace with the same workflow can also be done. [29]
Following is the list of popular Vagrant commands [16]
Command | Description |
---|---|
connect | connects to a remotely shared Vagrant environment |
destroy | stops and deletes all traces of the Vagrant machine |
global-status | outputs status Vagrant environments for this user |
halt | stops Vagrant machine |
help | shows the help for a subcommand |
init | initializes a new Vagrant environment by creating a vagrantfile |
login | logs in to HashiCorp's Atlas |
package | packages a running Vagrant environment into a box |
plugin | manages plugins: install, uninstall, update, etc. |
provision | provisions the Vagrant machine |
push | deploys code in this environment to a configured destination |
rdp | connects to machine via RDP |
reload | restarts Vagrant machine, loads new vagrantfile configuration |
resume | resumes a suspended Vagrant machine |
share | shares your Vagrant environment with anyone in the world |
ssh | connects to machine via SSH |
ssh-config | outputs OpenSSH valid configuration to connect to the machine |
status | outputs status of the Vagrant machine |
suspend | suspends the machine |
up | starts and provisions the Vagrant environment |
version | prints current and latest Vagrant version |
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.