Skip to main content
  1. Posts/

What is Vagrant? Differences Between Vagrant and VirtualBox

·650 words·4 mins· ·
Xianpeng Shen
Author
Xianpeng Shen
Table of Contents

What is Vagrant
#

Vagrant is an open-source software product used to easily build and maintain virtual software development environments.

For example, it can build development environments based on providers such as VirtualBox, VMware, KVM, Hyper-V, AWS, and even Docker. It improves development efficiency by simplifying the configuration management of virtualized software.

Vagrant is developed in Ruby, but its ecosystem supports development in several other languages.

Simply put, Vagrant is an encapsulation layer over traditional virtual machines, allowing you to use virtual development environments more conveniently.

Vagrant’s History
#

Vagrant was initially launched as a personal project by Mitchell Hashimoto in January 2010.

The first version of Vagrant was released in March 2010. In October 2010, Engine Yard announced that they would sponsor the Vagrant project.

The first stable version of Vagrant, Vagrant 1.0, was released in March 2012, exactly two years after the original release.

In November of the same year, Mitchell founded HashiCorp to support full-time development of Vagrant. Vagrant remains open-source software, and HashiCorp is committed to creating commercial versions and providing professional support and training for Vagrant.

Now HashiCorp has become a world-leading open-source company. Through a series of products, including Vagrant, Packer (packaging), Nomad (deployment), Terraform (cloud environment configuration), Vault (access management), and Consul (monitoring), it has redefined the entire DevOps process from end to end.

Vagrant initially supported VirtualBox, and version 1.1 added support for other virtualization software (such as VMware and KVM), as well as support for server environments such as Amazon EC2. Starting with version 1.6, Vagrant natively supported Docker containers, which can replace fully virtualized operating systems in some cases.

How to Use Vagrant
#

Prerequisites for using Vagrant:

  1. Install Vagrant. Download Vagrant
  2. Install VirtualBox

Once both are ready, you can create and use your virtual machine via the command line.

For example, you need an Ubuntu 18.04 LTS 64-bit virtual machine. More virtual machines can be searched for on the Box website, which is similar to Docker Hub, where users can download and upload various Vagrant Boxes.

You only need to execute a few simple commands to complete startup, login, logout, and destruction.

Initialize Vagrant

vagrant init hashicorp/bionic64

Start the virtual machine. This should take a few tens of seconds (the first time will take longer to download the image, depending on your internet speed).

vagrant up

Log in to your virtual machine, and you can then use your created Ubuntu virtual machine.

vagrant ssh

When you’re done, execute logout to log out.

Differences Between Vagrant and Traditional Virtual Machine Software
#

Vagrant

Vagrant is much more convenient than traditional virtual machine usage. Let’s look at how to create a virtual machine using the traditional method.

Taking VirtualBox as an example, assuming you have already installed VirtualBox, the steps to create a virtual machine using the traditional method are as follows:

First, download the corresponding ISO file. Then, load the ISO using VirtualBox or VMware. Finally, configure the CPU, memory, disk, network, user, etc., and wait for the installation to complete.

This method is very cumbersome to configure, requiring step-by-step operations. These configuration steps often require documentation to ensure that an “identical” virtual development environment can be created later.

By comparison, you should now have a general understanding of how Vagrant is used and some of the differences between it and traditional virtual machine usage.

Summary
#

The advantages of Vagrant over traditional virtual machine usage: it provides easy-to-configure, reproducible, and portable work environments, thereby improving productivity and flexibility.

Vagrant can be said to be the easiest and fastest way to create and manage virtualized environments!

It is able to be so convenient because it stands on the shoulders of giants (VirtualBox, VMware, AWS, OpenStack, or other providers), and then uses tools such as Shell scripts, Ansible, Chef, and Puppet to automatically install and configure software on the virtual machine.

The next article will introduce the differences between Vagrant and Docker.

Related

What is Go? Advantages, Current Status, and Choosing Between Python and Go for Beginners
·883 words·5 mins
This article introduces the basic concepts, advantages, and ranking of the Go programming language. It also guides beginners on choosing between learning Python or Go, providing practical learning suggestions and resources.
You Must Know These 17 Docker Best Practices!
·3928 words·19 mins
This article shares some best practices to follow when writing Dockerfiles and using Docker, including suggestions on multi-stage builds, image optimization, and security.
2021-22 World Quality Report (WQR)
·1692 words·4 mins
This article presents the key findings and trends from the 2021-22 World Quality Report (WQR), highlighting the impact of the COVID-19 pandemic on software quality and testing, and the crucial role of QA in Agile and DevOps.
How to fix "hidden symbol `__gcov_init' in ../libgcov.a(_gcov.o) is referenced by DSO"
·323 words·2 mins
This article explains how to resolve the “hidden symbol `__gcov_init’ in ../libgcov.a(_gcov.o) is referenced by DSO” error when building a project with Gcov, including how to ensure symbols are not hidden.
Regarding Extremely Slow and Occasional Upload Failures to Artifactory — A Case Study
·353 words·2 mins
Encountered slow upload speeds and occasional failures when uploading artifacts to JFrog Artifactory. This post shares the troubleshooting process and lessons learned.
Branch Naming Convention
·205 words·1 min
This article introduces the conventional branch naming specification, including the purpose of branch names, key points, and basic rules for naming branches in Git. It also provides examples of branch prefixes and their meanings.