Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Vagrant on Ubuntu 20.04 - DesignLinux

designlinux 0 Comments

Vagrant is a command-line tool for building and managing virtual machines.

By default, Vagrant can provision machines on top of VirtualBox, Hyper-V, and Docker. Other providers such as Libvirt (KVM), VMware and AWS can be installed via the Vagrant plugin system.

Vagrant is typically used by developers to set up a development environment that works across multiple operating systems.

This article describes how to install Vagrant on an Ubuntu 20.04 machine. We’ll use VirtualBox, which is the default provider for Vagrant.

Installing Vagrant on Ubuntu #

We will provision the virtual machines on top of VirtualBox.

If VirtualBox is not installed on your system you can install it by running:

sudo apt updatesudo apt install virtualbox

The Vagrant package, which is available in Ubuntu’s repositories, is not regularly updated. We’ll download and install the latest version of Vagrant from the official Vagrant site.

At the time of writing this article, the latest stable version of Vagrant is version 2.2.9. Visit the Vagrant downloads page to see if there is a new version of Vagrant available.

Download the Vagrant package with wget:

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

Once the file is downloaded, install it by typing:

sudo apt install ./vagrant_2.2.9_x86_64.deb

To verify that the installation was successful, run the following command that will print the Vagrant version:

vagrant --version

The output should look something like this:

Vagrant 2.2.9

Getting Started with Vagrant #

Creating a Vagrant project is simple as setting up the project root directory and defining a Vagrantfile.

Run the following commands to create the directory and cd into it with:

mkdir ~/my-vagrant-projectcd ~/my-vagrant-project

Next, initialize a new Vagrantfile using the vagrant init command followed by the box you want to use.

Boxes are the package format for the Vagrant environments and are provider-specific. You can find a list of publicly available Vagrant Boxes on the Vagrant box catalog page.

In this example, 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 is a Ruby file that describes how to configure and provision the virtual machine. You can open the Vagrantfile, read the comments and make adjustment according to your needs.

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: 192.168.121.74:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Rsyncing folder: /home/linuxize/Vagrant/my-vagrant-project/ => /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:

vagrant ssh

You can stop the virtual machine with the following command:

vagrant halt

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

vagrant destroy

Conclusion #

We’ve shown you how to install Vagrant on Ubuntu 20.04 and create a basic Vagrant project.

To find more information about Vagrant visit, the official Vagrant documentation page.

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

vagrant ubuntu

Related

Tags: ubuntu, vagrant

Top Linux Distributions To Look Forward To In 2020

Prev Post

How to Install Tomcat 9 on Ubuntu 20.04

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 4
  • 530
  • 612,709

DesignLinux.com © All rights reserved

Go to mobile version