Vagrant and Virtualbox Installation on Fedora

This article explains how to install Vagrant and Virtualbox on Fedora 23/24 so you can build your development environments.

Vagrant and Virtualbox provide an easy way to create, configure and distribute development environments.

Here I'll show you how to install them on Fedora 23.

UPDATE 2016-06-25: This play is also working on the brand new Fedora 24 with just a glitch about few missing headers files, see my note at the end.

VirtualBox Installation

Add VirtualBox repository and update your system:

$ sudo su -
# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
# dnf update

Ensure that you are running latest installed kernel version, you can check it by comparing the output of following commands, version numbers should match:

# rpm -qa kernel |sort -V |tail -n 1
# uname -r

If you got a kernel update then reboot your system.

Install VirtualBox dependencies:

# dnf install binutils gcc make patch libgomp glibc-headers \
  glibc-devel kernel-headers kernel-devel dkms
# dnf install VirtualBox-5.0

Last command will build needed kernel modules, in case you need in the future to rebuild them, you can use the following command:

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

In order to use VirtualBox, a user must be member of vboxusers group which was created automatically during Virtualbox installation. Add your username to vboxusers group

# usermod -a -G vboxusers username

Vagrant Installation

Run the following commands to install Vagrant:

$ sudo dnf install vagrant

Note that Fedora use libvirt as default provider, so to use Virtualbox instead you need to set an environment variable for it. Run the following commands:

$ echo "export VAGRANT_DEFAULT_PROVIDER=virtualbox" >> ~/.bashrc

If you prefer to use Vagrant with KVM, make sure to install libvirt packages for it.

$ sudo dnf install -y vagrant vagrant-libvirt libvirt-devel

Finally, install some useful vagrant plugins, but before we need to install .

$ vagrant plugin install vagrant-cachier
$ vagrant plugin install vagrant-hostmanager

UPDATE 2016-06-25:

While installing vagrant-cachier on a brand new Fedora 24 I had some errors about missing headers, to fix it you need to install the following packages:

$ sudo dnf install ruby-devel redhat-rpm-config zlib-devel

You can find more info about Gems installation in the Fedora Developer site.

Launch a Vagrant box

Now you can launch a vagrant box, for example try the official CentOS 7.

$ vagrant init centos/7
$ vagrant up --provider virtualbox

if you use libvirt provider:

$ vagrant up --provider libvirt

--

Danilo