How to Install Vagrant on Ubuntu 18.04

Install Vagrant on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Vagrant on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Vagrant allows you to easily manage and control multiple virtual machines. It is built on top of VirtualBox and VMWare, and it provides many exciting capabilities. You can create isolated development environments, experiment with new products and technologies, install new versions of existing packages, create your own private data center on your laptop, and run different operating systems. All that is available in an easy-to-manage and totally safe silo that can’t interfere with your main activities and operating system.

Install Vagrant on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install VirtualBox.

To install the VirtualBox package run the command below:

Step 3. Install the Vagrant on Ubuntu 18.04.

The next step is to install the Vagrant package from the Ubuntu repositories:

Once vagrant is installed successfully on Ubuntu, you need to verify the installation:

Step 4. Deploying Vagrant on Ubuntu.

Create a directory which will be the project root directory and hold the Vagrantfile file:

Next, download and install your operating system (Vagrant Box) of choice. For example, this command will install the CentOS 7 system:

Then, create and configure the virtual machine according to the Vagrantfile with:

The system should show the default SSH address, username, and authentication method for the new virtual machine. To ssh into the virtual machine simply run:

You can stop the virtual machine using following command:

To delete the virtual machine, use the command:

That’s all you need to do to install Vagrant on Ubuntu 18.04 Bionic Beaver. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.