Laravel Valet is an elegant tool for developing and testing PHP-based web apps. It was only available for macOS but ports for Linux and Windows are also available. In this article, I will try to demonstrate how to install Laravel Valet on any Linux distro but as an example, I will show how to do it in Fedora. Fedora uses ‘dnf’ to install packages, if you’re using another distro then make sure to replace the ‘dnf’ part of the command with ‘apt’ for Debian based system or ‘pacman’ for Arch-based systems.
To install valet we need composer and some other dependencies like nginx, php, mcrypt, etc. Let’s start with PHP and its extensions. To do that, open our favorite terminal and run the following commands.
sudo dnf -y update sudo dnf install nss-tools jq xsel sudo dnf install php php-cli php-process php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
When it finishes, run the command below to install composer to the current directory.
curl -sS https://getcomposer.org/installer | php
Now, lets move the composer.phar to ‘/usr/local/bin/composer’ to make it globally available to all users.
mv composer.phar /usr/local/bin/composer chmod +x /usr/local/bin/composer
Now, add the path to your global $PATH variable by adding the following line to the end of your .bashrc file in your home directory. Run the’ gedit .bashrc’ command to edit the file. For Zsh users it .zshrc instead of .bashrc.
Fedora users are expected to have knowledge of SELinux and how to configure or disable it while Valet makes changes to the system files, otherwise, you will receive errors about changes that could not be made.
The easiest way is to set SELinux in Permissive mode.
How to set SELinux in Permissive Mode
Temporarily (until reboot):
sudo setenforce 0
Now its the time to install valet using composer. Run the following two commands.
composer global require cpriego/valet-linux valet install
That’s it. If you have followed along you will have valet installed on your system.
Install Maria-DB (Optional)
sudo dnf install mariadb-server sudo systemctl start mariadb.service sudo systemctl enable mariadb.service sudo mysql_secure_installation
Happy valet parking!