22.6 C
Texas

How to install and configure Vagrant in Windows 10

Hello! Vagrant is a free, multi-platform command-line tool, which makes it easy to create reproducible and shareable development environments. Additionally, it creates small configuration files that can be moved between environments. Also, these files are called Vagrantfiles and can be shared between developers to replicate already created virtual machines on their computers. As you can see, the use of Vagrant is useful in development teams assembled by several people. It allows you to verify that all members are working with the same development environment. Therefore, it is an excellent alternative for solving software compatibility problems with operating systems. On the other hand, it allows the projects to be accompanied by their already configured environment since the configuration files are plain text files. Consequently, they can be versioned on platforms like Git. Let’s see in this post, how to install and configure Vagrant in Windows 10.

Prerequisites

  • Vagrant requires virtualization software. It can be VirtualBox or VMware. In this case, we will use the default option which is VirtualBox. To find out how to use it, take a look at our tutorial.
  • An SSH client for Windows 10. I recommend free, portable and lightweight Cmder

Downloading and Installing Vagrant

The installer can be downloaded from this link. Installation is as simple as any Windows app. Indeed, just follow the steps of the wizard and that’s it!

Once the installation process is complete, you can verify it by running the following command into a Command Prompt:

vagrant
- Advertisement -

If the console shows the available commands, then the installation is correct. If not, Vagrant was not installed or VirtualBox is not present.

Downloading the box.

The boxes are the virtualized environments corresponding to an operating system or software. Well, in this case we’ll use Ubuntu 16.04 Xenial.

As the image shows, to download the box you just have to copy the commands in a command line. But first, you must create a folder where the settings of the virtual machine will be saved. With this intention use the command:

mkdir

Now navigate to the newly created directory, using the command:

cd

Please note that these pre-configurations can be done from CMD. However, to connect the machine you have to use cmder.

Setting up Vagrant

It is then time to create the Vagrant file for the box. With this in mind, execute the following command:

vagrant init ubuntu/xenial64

Now it’s time to create the virtual machine. Please note that this process takes a while, as you must download it and then install the box. Please execute the following command:

vagrant up

Now, we have a clean and ready to work Linux environment. To access it, please run this command.

vagrant ssh

You can check the operation of the virtual machine by opening VirtualBox. The machine will be running with the generic name assigned. Likewise, the configuration assigned to the box is shown.

Vagrant Box running on VirtualBox
Vagrant Box running on VirtualBox

If you want to disconnect from the machine, please execute:

exit

However, the machine remains on. Therefore, to turn it off it is necessary to execute this command:

vagrant halt

Finally, we have seen how to install and configure Vagrant in Windows 10. Please note that to use the box again, just repeat the steps above. First, turn the machine on with vagrant up and then connect with vagrant ssh. All right, we’re done for the moment. If you have any questions, please let us know in the question section. I also invite you to join our group on Telegram. Bye!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article