How to install Valet on Linux

Valet Park

In this article, I will try to demonstrate how to install linux 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 other distro than fedora then make sure to replace the ‘dnf’ part of command by 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 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 end of your .bashrc file in your home directory. Run ‘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 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!

References

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

Leave a Reply