πŸ“’ Actions Speak Louder Than Words!

Installing Vagrant (Laravel Homestead) on Fedora

Posted: Nov 16, 2019 | Reading time: 3 min
⚠️ Warning: This post is over a year old, the information may be out of date.
πŸ“’ I’ve moved to a new website. Please visit me at https://journal.robbi.my !
post

Assalamualaikum (Peace upon you),

Few of my friend are asking me how I manage Laravel (PHP) development locally. Previously I installed every stack (Nginx/Apache, PHP, MariaDB/MySQL, PostgreSQL, Redis.. etc) that I want to use and yeah that is overkill, especially when something are breakdown and I need to focus how to fix it.

“Time is GOLD”, instead of too much focus on this kind of problem and wasting so much time, I now prefer to using “ready baked” configuration box.

If you are using Windows there is XAMPP, Laragon and others LAMP package software that you can use for local development purpose. Some people use docker too.

But for me whom love use Linux and sometimes I booted on Windows…. I prefer to use Vagrant.

Why Vagrant? It much easier since it officially supported by Laravel which is called as HOMESTEAD.

As long you have good disk storage, good amount of RAM and a threesome of software.. which is VirtualBox, Vagrant and Kernel stuff.

Lets go step by step..shall we?

1. Kernel

You need to preparing kernel to be working with VirtualBox on your machine.

$ sudo dnf install gcc binutils make glibc-devel \
patch libgomp glibc-headers  \
kernel-headers kernel-devel-`uname -r` dkms
$ sudo dnf groupinstall "Development Tools"

Take note, Fedora is bleeding edge distro (which mean it is always rolling out with the latest software, features, driver etc). The newer kernel may doest work with newest Virtualbox. Because of this matter, I locked my kernel and only unlock (update) when necessary.

2. Virtualbox

I am using Virtualbox from RPM fusion repository. I don’t like to use Virtualbox official repos because they are mixing package as currently they mixing package for fedora 29 with Fedora 30 and Fedora 31. That ugly! :expressionless:

So use rpmfusion repos and install Virtual Box

$ sudo dnf install VirtualBox akmod-VirtualBox \
VirtualBox-kmodsrc VirtualBox-server \
virtualbox-guest-additions

# Add your user account to the vboxusers group.
$ sudo usermod -a -G vboxusers ${USER}

3. Vagrant

Always use official RPM files from HashiCorp. I do not suggesting you to use vagrant from Fedora repos because it always outdated and few version behind :smirk:

# Package I installed from HashiCorp is more up-to-date
$ vagrant -v
Vagrant 2.2.6

$ rpm -qi vagrant 
Name        : vagrant
Epoch       : 1
Version     : 2.2.6
Release     : 1
Architecture: x86_64
Install Date: Thu 14 Nov 2019 01:26:06 AM +08
Group       : default
Size        : 119202403
License     : MIT
Signature   : (none)
Source RPM  : vagrant-2.2.6-1.src.rpm
Build Date  : Tue 15 Oct 2019 01:01:04 AM +08
Build Host  : localhost
Relocations : / 
Packager    : HashiCorp <support@hashicorp.com>
Vendor      : root@localhost.localdomain
URL         : https://www.vagrantup.com
Summary     : Vagrant is a tool for building and distributing development environments.
Description :
Vagrant is a tool for building and distributing development environments.

# Package from Fedora repos is few version behind
$ sudo dnf provides vagrant
vagrant-2.2.3-1.fc30.noarch : Build and distribute virtualized development environments
Repo        : fedora
Matched from:
Provide    : vagrant = 2.2.3-1.fc30

vagrant-2.2.5-1.fc30.noarch : Build and distribute virtualized development environments
Repo        : updates
Matched from:
Provide    : vagrant = 2.2.5-1.fc30

vagrant-1:2.2.6-1.x86_64 : Vagrant is a tool for building and distributing development environments.
Repo        : @System
Matched from:
Provide    : vagrant = 1:2.2.6-1

The terminal output above just a prove, incase someone need it. I experience lot of problem using vagrant packages from Fedora. I learned my lesson.

So go to www.vagrantup.com/downloads and copy RPM package download link for CentOS and install on your machine like this.

$ sudo rpm -iVh https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.rpm

If everything OK then reboot your computer and visit Laravel website and follow how to download and using homestead here because now you are good to follow official documentation πŸ”₯

Edit

Have some thoughts, discussion or feedback on this post?
IndieWeb Interactions

Below you can find the interactions that this page has had using Indieweb. Which means, you can mentioned this URL on any website that support WebMention. Have you written a response to this post? Let me know the URL:

((Do you use a website that do not set up with WebMention capabilities? You can use Comment Parade.)