YouTube Icon

Code Playground.

How to Install Vagrant on CentOS 7


How to Install Vagrant on CentOS 7

Transient is an open-source order line apparatus for building and overseeing virtual machine conditions. Of course, Vagrant can arrangement machines on top of VirtualBox, Hyper-V, and Docker. Different suppliers, for example, Libvirt (KVM), VMware and AWS can be introduced through the Vagrant module framework. 

Transient is generally utilized by designers to set up an improvement climate that coordinates the creation climate. 

In this instructional exercise, we will walk you through introducing Vagrant on CentOS 7 frameworks. 


Guarantee that you have met the accompanying essentials prior to proceeding with this instructional exercise: 

VirtualBox introduced on your CentOS machine . 

Signed in as a client with sudo advantages . 

Installing Vagrant on CentOS

At the hour of composing this article, the most recent stable rendition of Vagrant is adaptation 2.2.6. Prior to proceeding with the following stage, visit the Vagrant downloads page and check if there is another form of Vagrant accessible. 

Utilize the accompanying order to introduce Vagrant on your CentOS machine: 

sudo yum install

To confirm that the establishment was effective run the accompanying order which will print the Vagrant adaptation: 

vagrant --version

The yield should look something like this: 

Vagrant 2.2.6

Getting Started with Vagrant

Since Vagrant is introduced on your CentOS framework, we will tell you the best way to establish an advancement climate. 

We'll be utilizing the VirtualBox supplier, which is the default supplier for Vagrant. 

The initial step is to make a registry that will be the venture root catalog and hold the Vagrantfile record. Vagrantfile is a Ruby record that portrays how to design and arrangement the virtual machine. 

Make the undertaking index and change to it with: 

mkdir ~/my-vagrant-project
cd ~/my-vagrant-project

The following stage is to introduce another Vagrantfile utilizing the transient init order and indicate the case you need to utilize. 

Boxes are the bundle design for the Vagrant conditions and are supplier explicit. You can discover a rundown of freely accessible Vagrant Boxes on the Vagrant box list page. 

In this model, we will utilize the ubuntu/bionic64 box. Run the accompanying order to introduce another Vagrantfile: 

vagrant init ubuntu/bionic64
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
`` for more information on using Vagrant.

You can open the Vagrantfile , read the remarks, and make changes as indicated by your requirements. 

Run the transient up order to make and design the virtual machine as per the Vagrantfile. 

vagrant up
==> default: Configuring and enabling network interfaces...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Rsyncing folder: /home/linuxize/Vagrant/my-vagrant-project/ => /vagrant

As should be obvious from the yield above Vagrant likewise mounts the venture registry at/transient in the virtual machine, which permits you to take a shot at your task's records on your host machine. 

To ssh into the virtual machine just run: 

vagrant ssh

You can stop the virtual machine with the accompanying order: 

vagrant halt

The accompanying order stops the machine on the off chance that it is running and demolishes all assets that were made during the formation of the machine: 

vagrant destroy


You have figured out how to introduce and utilize Vagrant on your CentOS 7 machine. We have additionally told you the best way to establish a fundamental improvement climate. 

To discover more data about Vagrant, visit the official Vagrant documentation page. 

On the off chance that you have any inquiries, kindly leave a remark underneath.