In this article, we will have explained the necessary steps to installing and configuring Vagrant on CentOS 8. 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 is a free and open-source software for easy provisioning and orchestration of virtual software development environments. By default, Vagrant can provision machines on top of VirtualBox, Hyper-V, and Docker. Support for other providers such as Libvirt (KVM), VMware, and AWS can be enabled via the Vagrant plugin system. Vagrant is developed by HashiCorp and distributed under MIT License.
- Operating System with CentOS 8
- Server IPv4 Address with Superuser Privileges (Root Access)
- Gnome Terminal for Linux Desktop
- PuTTy SSH client for Windows or macOS
- Powershell for Windows 10/11
- Familiar with DNF Commands
Install Vagrant on CentOS 8
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo dnf install epel-release sudo dnf update
Step 2. Installation Vagrant on the CentOS system.
Run the following command to install Vagrant on CentOS Linux:
sudo dnf install vagrant
The official versions in the repositories might be very outdated. If you want the most recent version, go to the official Vagrant downloads page and download the latest binary file for your Linux operating systems:
wget https://releases.hashicorp.com/vagrant/2.2.15/vagrant_2.2.15_x86_64.rpm sudo dnf install https://releases.hashicorp.com/vagrant/2.2.15/vagrant_2.2.15_x86_64.rpm
Now confirm the installation of Vagrant by checking the version installed:
Step 4. Setup Vagrant Environment.
To setup the Vagrant project environment, run the commands below to create a project folder in your home directory:
mkdir ~/my-vagrant-project-start cd ~/my-vagrant-project-start
Next, download and install your operating system (Vagrant Box) of your choice. For example, this command will install Ubuntu 20.04 system:
vagrant init ubuntu/20.04
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 the following command:
To delete the virtual machine, use the command:
That’s all you need to do to install Vagrant on CentOS 8. I hope you find this quick tip helpful. For further reading on Vagrant, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.