How to install Valet on Linux

PUBLISHED: June 25, 2020 IN

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 systems or 'pacman' for Arch-based systems.

Install Prerequisites

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, let's 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.

export PATH="$HOME/.config/composer/vendor/bin:$PATH"

Regarding SELinux[1]

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

Permanent:

  • Open /etc/selinux/config
  • Change SELINUX=enforcing to SELINUX=permissive
  • Reboot

Install Valet

Now it's 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!

References:

  1. https://cpriego.github.io/valet-linux/index

3 comments on “How to install Valet on Linux”

Leave a Reply

Your email address will not be published. Required fields are marked *

ABOUT

Sheehab Muhammad
I am Sheehab Muhammad — a Software Engineer experienced in Data Mining, Image Processing, Natural Language Processing, Machine Learning & Full-Stack Development.
Subscribe
Subscribe to my newsletter for fresh content of my site.
Copyright © 2024 Sheehab Muhammad. All Rights Reserved.