Vagrant is a command-line utility that is used in combination with a configuration file to define, configure, and run virtual machines. Vagrant is compatible with most of the major hypervisors, including VirtualBox, Hyper-V, and VMware.
- [Instructor] Why do people use Vagrant? Vagrant has several uses. Developers use Vagrant to preserve purpose-built isolated development environments. Software development environments depend on a combination of tools and libraries. As software versions age, those tools and libraries are updated and the older versions tend to be left behind. A Vagrant VM is frozen in time so to speak. A developer can load a collection of tools and libraries used to build a version of software and keep it indefinitely. One, two, or even five years later, any developer can run that VM and build that old software version.
VMs are also useful for active development of an application. Large development teams are often working on multiple components of a system at the same time. By working in VMs, developers can keep their component development environment separate. Working in VMs also makes the environments portable. Developers can snapshot a VM and share it with each other. Operators use Vagrant to build disposable desktop or server environments that can be used for testing and experimentation. They can then use those environments to evaluate new software, manage a lab environment, or test various configurations.
It's often much easier to load a pre-configured VM than it is to install complex enterprise software. Software vendors are using VMs as a method to provide software as a virtual appliance. Vagrant makes it very easy to create and share virtual appliances through Vagrant Cloud. There are three important components to Vagrant, the CLI, Vagrantfiles, and Vagrant Cloud. The first major component of Vagrant is the Command-Line tool or CLI. The CLI is used to start and stop Vagrant VMs, initialize new Vagrant environments, and manage running VMs.
The second major component of Vagrant is the file used to define Vagrant VMs, the Vagrantfile. Vagrantfiles are small programs in the Ruby language that are executed by the Vagrant CLI to define and run a Vagrant VM. It's quick and easy to learn to read and write Vagrantfiles even if you don't know Ruby. Vagrantfiles are mostly statements, not complex logic. Finally, the third major component of Vagrant is Vagrant Cloud. HashiCorp, the maker of Vagrant, provides Vagrant Cloud as an online marketplace for public virtual machines.
One of the great features of Vagrant VMs is their portability. The common format for Vagrant VMs makes them easy to share. Users of Vagrant can publish their own Vagrant VMs to Vagrant Cloud making them available publicly or use a private account to restrict access to their own organizations. Vagrant includes various features used to manage Vagrant VMs. These include connecting to a Vagrant VM. Vagrant includes a built-in SSH system to authenticate and connect to a running VM that supports the SSH protocol.
Folder synchronization, files on the host can be synchronized with files in a Vagrant VM and vice versa. Networking, Vagrant supports multiple networking configuration options for virtual machines. Providers, providers are plugins that provide support for a particular hypervisor. Provisioners, provisioners run the first time a Vagrant VM is started, installing software and setting configurations. And multi-machine Vagrantfiles, a single Vagrantfile can define more than one VM, supporting cases where an application environment is distributed across multiple virtual machines.
We'll be covering each of these features of Vagrant in later videos. The final video will bring all these concepts together using each one to define a custom development environment.
- What is Vagrant?
- Running your first box
- Connecting to a box
- Working with Vagrant Cloud
- Configuring boxes with Vagrantfiles
- Creating a developer environment
- Uploading a box to Vagrant Cloud