- Nikhil Bhaskar
- July 26, 2021
How to Install & Configure Vagrant on ubuntu 20.04
Vagrant is a command-line tool.It helps to create different operating system environments with virtual box. It is used for creating and managing virtual machines.
Install & Configure Vagrant on ubuntu
Update the system
apt-get update
Install VirtualBox.
apt install virtualbox
Download Vagrant packages file.
curl -O https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb
Install the downloaded file.
apt-get install ./vagrant_2.2.9_x86_64.deb
Check the Vagrant version.
vagrant --version
Here is the command output.
Vagrant 2.2.9
Create a folder & Change the directory.
mkdir project
&
cd project
Initialize a new Vargantfile.
vagrant init OS-name/version
or
vagrant init centos/8
Here is the command output.
==> vagrant: A new version of Vagrant is available: 2.2.17 (installed version: 2.2.9)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html
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.
Now Run the vagrantup command for start the Vagrant virtual environment.
vagrant up
Here is the command output.
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'centos/8'
default: URL: https://vagrantcloud.com/centos/8
==> default: Adding box 'centos/8' (v2011.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/centos/boxes/8/versions/2011.0/providers/virtualbox.box
Download redirected to host: cloud.centos.org
default: Calculating and comparing box checksum...
==> default: Successfully added box 'centos/8' (v2011.0) for 'virtualbox'!
Connect with new virtual machine.
vagrant ssh
Stop the virtual machine.
vagrant halt
Delete or remove all resources.
vagrant destroy
Uninstall the Vagrent.
apt-get remove --auto-remove vagrant