Home » How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

by Pring
How to install Vagrant on Windows environment

Introduction:

Vagrant is a tool for building and managing virtual machine environments in a single workflow. This archive is about how to install Vagrant on Windows environment. To install Vagrant, you need to install VirtualBox and Git.

I. Install Vagrant on Windows by step by step.

To install Vagrant on Windows. Follow these steps:
Step 1. Download VirtualBox.
Step 2. Install VirtualBox.
Step 3. Download Git (Git Bash).
Step 4. Install Git (Git Bash).
Step 5. Download Vagrant.
Step 6. Install Vagrant.
Step 7. Create a VM, configure Vagrantfile.
Step 8. Start a VM.

You can see details of Video on How to install Vagrant on Windows as below.
[Sorry, the video we will update later]

Or you also can see details as below.

Step 1. Download VirtualBox.

On browser, access VirtualBox page: http://download.virtualbox.org/virtualbox/6.1.20/. Download version for Windows. (VirtualBox-6.1.20-143896-Win.exe).

How to install Vagrant on Windows environment

Step 2. Install VirtualBox.

To install VirtualBox, Double Click on the download file in Step 1 . Then, follow the steps below. In this article, i use the default config.

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment 

Step 3. Download Git.

On browser, access Git page: https://git-scm.com/download/win. Download version for Windows. My computer is Windows 64-bit.
How to install Vagrant on Windows environment

Step 4. Install Git.

To install Git, Double Click on the download file in Step 3 . Then, follow the steps below.  In this article, i use the default config.
How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

Step 5. Download Vagrant.

On browser, access Git page: https://releases.hashicorp.com/vagrant/. Download version for Windows. 
I use Vagrant version 2.2.15
How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

Step 6. Install Vagrant.

To install Vagrant, Double Click on the download file in Step 5 . Then, follow the steps below.  In this article, i use the default config.

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

How to install Vagrant on Windows environment

Step 7. Create a VM, configure Vagrantfile.

1. Open Git Bash.

How to install Vagrant on Windows environment

2. In the folder where you want to create the VM (virtual machine). Create “Vagrantfile”, enter the command below :

vagrant.exe init

Example Output :

$ vagrant.exe init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

“Vagrantfile” file has been created.
Example:
How to install Vagrant on Windows environment

Editing the contents of the “Vagrantfile” file becomes as follows.

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.ssh.insert_key = false
  config.vm.provider :virtualbox do |vb|
    vb.memory = 256
    vb.cpus = 1
  end
  # Server 1.
  config.vm.define "server_01" do |server_01|
    server_01.vm.hostname = "devopsio.com"
    server_01.vm.box = "centos/8"
    server_01.vm.network :private_network, ip: "192.168.3.2"
  end
end

3. Create a VM, enter the command below :

vagrant up

Example Output :

$ vagrant up
Bringing machine 'server_01' up with 'virtualbox' provider...
==> server_01: Box 'centos/8' could not be found. Attempting to find and install...
    server_01: Box Provider: virtualbox
    server_01: Box Version: >= 0
==> server_01: Loading metadata for box 'centos/8'
    server_01: URL: https://vagrantcloud.com/centos/8
==> server_01: Adding box 'centos/8' (v2011.0) for provider: virtualbox
    server_01: Downloading: https://vagrantcloud.com/centos/boxes/8/versions/2011.0/providers/virtualbox.box
==> server_01: Box download is resuming from prior download progress

Download redirected to host: cloud.centos.org
    server_01:
    server_01: Calculating and comparing box checksum...
==> server_01: Successfully added box 'centos/8' (v2011.0) for 'virtualbox'!
==> server_01: Importing base box 'centos/8'...
==> server_01: Matching MAC address for NAT networking...
==> server_01: Checking if box 'centos/8' version '2011.0' is up to date...
==> server_01: Setting the name of the VM: DevOpsiocom_server_01_1619680698740_13110
==> server_01: Clearing any previously set network interfaces...
==> server_01: Preparing network interfaces based on configuration...
    server_01: Adapter 1: nat
    server_01: Adapter 2: hostonly
==> server_01: Forwarding ports...
    server_01: 22 (guest) => 2222 (host) (adapter 1)
==> server_01: Running 'pre-boot' VM customizations...
==> server_01: Booting VM...

Step 9. Start a VM.

To connect to VM server, use vagrant ssh (Connecting non-GUI Linux OS), enter the command below :

$ vagrant.exe ssh

II. Conclusion.

In this tutorial, we’ve installed Vagrant on Windows. If you hit a problem or have feedback, leave a comment below.


Install Vagrant on Windows is complete. Wish you success and luck.
Thanks and best regards!
— Pring —

Related Articles

Leave a Comment