How to install Valet on Linux

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.

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 | 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.

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


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

Install Valet

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!



Customizing the Terminal with Zsh

Let’s start by installing the Zsh, run the following commands. Replace ‘dnf’ with your package manager. I am running this command on Fedora 32 and for me, it’s ‘dnf’.

sudo dnf install zsh
zsh --version

You may see something similar to ‘zsh 5.8 (x86_64………….’ if Zsh is successfully installed.

Now, let’s install Oh-My-Zsh, Run the command below.

sh -c "$(wget -O -)"

When the installation is complete, we need to set the Zsh as our default. Go to Edit>Preference>Profiles and select the Command tab. From there, select the run a custom command instead of my shell and write ‘zsh’ in the text field underneath.

At this point, you have Zsh and Oh-my-zsh installed. Now, let’s customize it with ‘powerlevel10k‘ theme. To make ‘powerlevel10k’ theme work properly, we need to install some fonts.

Double-click on each font after downloading and click “Install”. This will make MesloLGS NF font available to all applications on your system.

Finally, install the powerlevel10k theme by following command.

git clone --depth=1 ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

When the installation is complete, run the command below.

gedit .zshrc

And set the value of ZSH_THEME like ZSH_THEME="powerlevel10k/powerlevel10k". Save and Close it and then restart your terminal. You’ll be asked to complete the theme setup process, configure as your preference

Leave a comment if you have any questions or suggestions.