
$ vagrant init generic/ubuntu2004 => Create a vagrant config file Now pass the box name as the argument with the vagrant init command which will automatically set the box name in the Vagrant file. Download Vagrant Ubuntu BoxĬlick the box from the site and you can get the box name to configure in the vagrant file. In the vagrant, site search for “ Ubuntu20” and set the Provider to Virtualbox as shown in the below image. I am going to download the Ubuntu20.04 box. This parameter will take care of downloading the box from the vagrant site.

#Vagrant install install#
View Vagrant Configuration File Install a Virtual Machine with Vagrant and VirtualBoxĪt the moment all you need to care about is modifying a single parameter “ config.vm.box”. This file is where we are going to store all our box-related configuration information. Now open the vagrant file, which is a template file created by the vagrant when you run the vagrant init command. Now move into the newly created directory and run the vagrant init command, which will create a vagrant configuration file in your project directory. You can create this directory in any location you want in your file system. Open the terminal and create a project directory by running the following command. Let’s start creating a project and download a vagrant box. On the site, you can search for different box flavors (CentOS, Ubuntu, Arch, etc.) and you also have the option to choose a Provider (here we using VirtualBox as provider). There are boxes hosted on the vagrant site which is already packaged and ready to use. You can create your own custom box and share it among others and use an identical environment or download the boxes from the vagrant site.

There are two ways you can get the boxes. When I say boxes throughout this series I am just referring to a virtual machine. When you download or package a virtual machine to be used in vagrant it will be in box format. The vagrant box is a package format for the vagrant environment.
#Vagrant install how to#
In this article, you will learn how to create a Vagrant project to install a vagrant box, configure a guest machine, and understand core aspects of vagrant and important configurations and commands. In the previous article, we have seen how to set up vagrant in your Linux distribution.
