• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Vagrant on Ubuntu 20.04

Written by Admin, Updated On July 11, 2020
ubuntu, vagrant
How to Install Vagrant on Ubuntu 20.04

Vagrant is a an open-source tool for building and managing virtual machines. Generally, Vagrant is used by developers to set up a development environment that works across multiple operating systems. In this tutorial, we will show you how to install Vagrant on Ubuntu 20.04 system.

Prerequisites#

  • Virtualbox should installed on your Ubuntu 20.04 system.
  • You must logged in as root or user with sudo privileges.

Installing Vagrant on Ubuntu#

By default Ubuntu repositories includes Vagrant package, but it is not regularly updated. So we will download and install latest version of Vagrant from the official Vagrant website.

Currently, at the time of writing this tutorial, the latest version of Vagrant is 2.2.9. It always good to check latest version at Vagrant download page before starting installation.

Run the below command to download Vagrant using curl:

curl -O https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb

Once the download complete, execute below command to install it:

sudo apt install ./vagrant_2.2.9_x86_64.deb

You can verify the installation by typing:

vagrant --version

It should show output as following:

Vagrant 2.2.9

Using Vagrant on Ubuntu#

It’s very simple to create a Vagrant project. To define a root directory run below command to create the directory and navigate into it with:

mkdir ~/vagrant-test
cd ~/vagrant-test

After that, we need to initialize a new Vagrantfile using the vagrant init command, followed by the box you want to use.

Get the list of publicly available Vagrant Boxes on the Vagrant box catalog page.

For demostration we will use the centos/8 box:

vagrant init centos/8
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 describes the type of machine required and how to configure. You can edit the Vagrantfile and do changes as your needs.

Now, run the vagrant up command to create and configure the virtual machine as specified in the Vagrantfile:

vagrant up
==> default: Configuring and enabling network interfaces...
    default: SSH address: 53.21.54.56:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Rsyncing folder: /home/tecnstuff/Vagrant/vagrant-test/ => /vagrant

Vagrant mounts the project directory at /vagrant in the virtual machine. This allows you to work on your project’s files on your host machine.

To ssh into the virtual machine, run:

Run the below command to login to VM using SSH:

vagrant ssh

To shutdown the virtual machine execute the below command:

vagrant halt

To destroy all resources created during the creation of the machine, enter:

vagrant destroy

Conclusion#

This article shown you how to install Vagrant on Ubuntu 20.04 and use of Vagrant project. To know more about Vagrant visit, the official Vagrant documentation page.

If you have any questions, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article Ln Command in Linux (Create Symbolic Links)
Next Article   How to Install GCC on Ubuntu 20.04

Related Posts

  • How to Install Wine on Ubuntu 20.04

    March 13, 2021
  • How to Install Microsoft Edge Browser on Ubuntu 20.04

    February 14, 2021
  • How to Install Php 8 on Ubuntu 20.04

    How to Install PHP 8 on Ubuntu 20.04

    December 28, 2020

Leave a Reply Cancel reply

Popular Posts

© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook