FedoraRHEL Based

How To Install Vagrant on Fedora 39

Install Vagrant on Fedora 39

In this tutorial, we will show you how to install Vagrant on Fedora 39. Vagrant is an open-source tool designed to streamline the process of setting up and managing virtual machine environments. It is particularly useful in development, testing, and production environments, as it enables the creation of consistent environments that can be easily shared and replicated.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Vagrant on a Fedora 39.

Prerequisites

Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora 39 provides the Terminal application for this purpose. It can be found in your Applications menu.
  • You’ll need an active internet connection to download Vagrant and its dependencies.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Vagrant on Fedora 39

Step 1. Checking CPU Virtualization Extensions.

Before you begin the installation process, it’s crucial to confirm that your CPU supports either Intel VT or AMD-V virtualization extensions. Some systems may have this feature disabled in the BIOS, and you may need to enable it. You can check this by running the following command in your terminal:

cat /proc/cpuinfo | egrep "vmx|svm"

If your CPU supports these extensions, the command will return either “vmx” (for Intel VT) or “svm” (for AMD-V).

Step 2. Installing VirtualBox.

To install VirtualBox, you first need to add the VirtualBox RPM repository to your Fedora system. You can do this by running the following commands:

sudo dnf -y install wget
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
sudo mv virtualbox.repo /etc/yum.repos.d/virtualbox.repo

After adding the repository, you can install VirtualBox with the following commands:

sudo dnf install gcc binutils make glibc-devel patch libgomp glibc-headers kernel-headers kernel-devel-`uname -r` dkms
sudo dnf install VirtualBox-7.0

Next, add your user account to the vboxusers group:

sudo usermod -a -G vboxusers ${USER}

Finally, configure the VirtualBox drivers:

sudo /usr/lib/virtualbox/vboxdrv.sh setup

This command will stop the VirtualBox services, start them again, and build the VirtualBox kernel modules.

Step 3. Installing Vagrant on Fedora 39.

After installing VirtualBox, you can proceed to install Vagrant. Vagrant is a tool that enables users to create and configure lightweight, reproducible, and portable development environments. You can install Vagrant on Fedora by running the following command:

sudo dnf install vagrant

After installing Vagrant, you can add a Vagrant box to your system. A Vagrant box is a package that contains a preconfigured Vagrant environment. You can add a box by running the following command:

vagrant box add fedora/32-cloud-base --provider=libvirt

This command will download and add the fedora/32-cloud-base box to your system.

Step 4. Creating a Vagrantfile.

A Vagrantfile is a Ruby file used to configure Vagrant on a per-project basis. You can create a minimal Vagrantfile to test your setup. Here’s how to do it:

mkdir vagrant-test
cd vagrant-test
nano Vagrantfile

In the Vagrantfile, add the following lines:

Vagrant.configure("2") do |config|
  config.vm.box = "fedora/39-cloud-base"
  config.vm.box_version = "39.20231031.1"
end

This configuration tells Vagrant to use the fedora/39-cloud-base box for the virtual machine.

Step 5. Troubleshooting Tips.

Despite your best efforts, you may encounter some issues when using Vagrant and VirtualBox. Here are some common problems and their solutions:

  1. Vagrant commands hanging on Windows: This issue may be due to a permissions problem with VirtualBox. To fix it, shut down all VirtualBox machines and GUIs, wait a few seconds, and then launch VirtualBox with the access level you wish to use.
  2. DNS not working within your VM: If DNS is not working within your virtual machine, you may need to enable a DNS proxy built into VirtualBox.
  3. Vagrant starts, but the /vagrant folder does not exist: This issue may be due to Hyper-V being enabled on your system. To fix it, turn off Hyper-V in the Windows Features window.

Congratulations! You have successfully installed Vagrant. Thanks for using this tutorial for installing Vagrant on your Fedora 39 system. For additional Apache or useful information, we recommend you check the official Vagrant website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button