How to install Vagrant locally? The 2 ways

Are you a Devops Engineer or an IT engineer who wants to spin up a virtual machine for locally testing the apps or to install any service locally?

We have a free way to achieve it using a VM automation tool called ‘Vagrant’.

Now next checkpoint is How to install Vagrant locally?

How to install Vagrant locally

How to install Vagrant locally?Your Gateway to Easy Development Environments

Vagrant streamlines the process of creating and managing virtual machines (VMs) for development. This allows you to set up isolated environments with specific operating systems and configurations, perfect for testing and development. If you’re looking to get started with Vagrant, this guide will walk you through the installation process.

What You’ll Need:

  • An internet connection
  • A computer running Windows, macOS, or Linux

You may also like: How to create your own Database locally on your laptop?

Method 2: Using Software package

Installation Steps:

  1. Download Vagrant: Head over to the official Vagrant download page . There, you’ll find installers for Windows, macOS, and various Linux distributions. Choose the installer compatible with your operating system.

  2. Run the Installer: Double-click the downloaded installer and follow the on-screen instructions. The installation process is typically straightforward and shouldn’t take long.

Verifying Installation (Optional):

Once the installation is complete, you can verify Vagrant is working correctly by opening a terminal (command prompt on Windows) and typing the following command:

vagrant --version

If Vagrant is installed successfully, this command should display the installed Vagrant version.

Ex:

$ vagrant –version

Vagrant 2.4.0

Additional Software:

While Vagrant can function on its own, it works best alongside a virtual machine provider like VirtualBox https://www.virtualbox.org/wiki/Downloads. VirtualBox allows Vagrant to create and manage VMs. Download and install VirtualBox following a similar process as Vagrant.

Method 2: Using CLI

You can use the command line interface (CLI) to install Vagrant. Here’s how to do it on different operating systems:

Linux:

Most Linux distributions have Vagrant packages available in their official repositories. Here’s an example using apt on Ubuntu or Debian-based systems and yum on rpm based OS like CentOS:

sudo apt update

sudo apt install vagrant

Replace apt with your package manager if your distribution uses something different (e.g., yum on RedHat-based systems).

macOS:

You can use Homebrew, a popular package manager for macOS, to install Vagrant:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install vagrant

Windows:

Download the Vagrant installer for Windows from the official website https://www.vagrantup.com/ as mentioned before. The installer itself is a CLI program and will guide you through the installation process.

Verifying Installation:

Once you’ve installed Vagrant using the CLI, you can verify it using the same command mentioned earlier:

vagrant --version

This should output the installed Vagrant version if successful.

Additional Notes:

  • Remember to adjust the commands based on your specific Linux distribution and package manager.
  • Installing VirtualBox through the CLI might also be possible depending on your system. Check the VirtualBox website for instructions specific to your OS.

By using the CLI, you can automate Vagrant installation scripts or integrate it into your development workflow.

Congratulations! You’ve now successfully installed Vagrant and are ready to start creating development environments with ease. Many online tutorials and resources utilize Vagrant, so you’ll have a wealth of information at your fingertips to start exploring its capabilities.

1 thought on “How to install Vagrant locally? The 2 ways”

Leave a comment