Share your love
Install and Use Vagrant on AlmaLinux 8 with Efficient Steps

In this tutorial on the Orcacore website, we want to show you how to Install and Use Vagrant on AlmaLinux 8. Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past.
Table of Contents
Steps To Install and Use Vagrant on AlmaLinux 8
To Install and Use Vagrant on AlmaLinux 8, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article about the Initial Server Setup with AlmaLinux 8.
Also, you need to install VirtualBox on your server. For this, you can check our article How To Install VirtualBox on AlmaLinux 8.
1. Vagrant Setup on AlmaLinux 8
To install Vagrant, you need to install the yum-utils package on your server:
sudo dnf install -y yum-utils
Add Vagrant Repository
Then, use the command below to add the Vagrant repo on AlmaLinux 8:
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
Install Vagrant
Next, you can install the latest Vagrant with the following command:
sudo dnf -y install vagrant
Now you can verify your installation by checking the Vagrant version:
vagrant --version
In your output you will see:
Output
Vagrant 2.3.4
You have successfully installed Vagrant on AlmaLinux 8, let’s see how to use it.
2. How To Use Vagrant?
At this point, we want to show you how to use Vagrant by creating a development environment.
First, you need to create a file to save the Vagrant file there. To do this, run the following command:
mkdir ~/vagrant-project
Then, you need to initialize a new Vagrantfile and specify the box you wish to use on AlmaLinux 8. Boxes are the package format for the Vagrant environments and are provider-specific.
You can check the list of available Vagrant Boxes on the Vagrant Catalog page.
In this example, we want to use ubuntu/trusty64.
Switch to your Vagrant project directory on AlmaLinux 8 with the following command:
cd ~/vagrant-project
Now initialize the Vagrantfile with the following command:
vagrant init ubuntu/trusty64
In your output you will see:

You can open the Vagrantfile with your favorite text editor and make changes according to your needs on AlmaLinux 8.
Run the following command to create and configure the virtual machine as defined in the Vagrantfile:
vagrant up
Output
==> default: Configuring and enabling network interfaces...
...
Vagrant mounts the project directory at /vagrant in the virtual machine. This allows you to work on the project’s files on your host machine.
You can use the following command to ssh to your virtual machine:
vagrant ssh
Also, you can stop the virtual machine with the command below:
vagrant halt
If you want to stop and destroy all resources that were created during the creation of the machine, you can use the following command:
vagrant destroy
Conclusion
As we said, Vagrant is a tool for building and managing virtual machine environments in a single workflow. At this point, you have learned to Install and Use Vagrant on AlmaLinux 8.
Hope you enjoy using it. Also, you may like to read the following articles:
Set up OpenJDK 19 on AlmaLinux 8
Install and Configure OpenNMS on Rocky Linux 8
Postman API Testing AlmaLinux 8
Siege Stress Tester AlmaLinux 8