Install Laravel Valet Linux+ development environment on Ubuntu System

Harish Kumar · · 21388 Views

The official Laravel Valet development environment is great if you are an Apple user. But there is no official Valet for Linux or Window system.

But we have two different versions of the Valet for Linux system created by the community. These are:

  1. cpriego/valet-linux (Valet Linux)

  2. genesisweb/valet-linux-plus (Valet Linux+)

If we compare both, Valet Linux+ has more features. For example, it provides MySQL database handling from command-line, MailHog, Redis, Sharing Sites on LAN, Securing Sites With TLS (HTTPS), etc.

So, In this article, I will show you how to install valet-linux-plus in your Ubuntu system. 

Requirements

  1. Ubuntu 14.04+

  2. PHP 7.1+

  3. PHP extensions: php-cli php-curl php-mbstring php-mcrypt php-xml php-zip

If you are on Ubuntu 14.04, then you need to add the Nginx PPA because the version in the Trusty repos does not support http2. And http2 is required if you want to use the valet secure command.

Run this command to add the Nginx PPA, if you are on Ubuntu 14.04 or below:

sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get update

Install dependencies packages

sudo apt-get install network-manager libnss3-tools jq xsel

Install PHP & it's extensions

Currently, the latest version of PHP is v8.0. So, I will install PHP 8. For that first, we need to add PPA for PHP 8. 

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Install PHP8

sudo apt install php8.0-fpm

Install PHP Extensions:

sudo apt install php8.0-cli php8.0-common php8.0-curl php8.0-mbstring php8.0-opcache php8.0-readline php8.0-xml php8.0-zip php8.0-mysql php8.0-gd

Install MySql Server

Valet Linux+ automatically installs the MySql server. But sometimes, it gives an error on MySQL installation via valet install command. So, I recommend installing the MySql server first before starting the installation of the valet.

So, to install the MySql server run the following command:

sudo apt-get -y install mysql-server

Once it is installed, run the following command and follow the instructions:

sudo mysql_secure_installation

By default, we need sudo privileges to gain access to the root MySQL user.

That, we need to change. We will use the mysql_native_password plugin to authenticate the root MySQL user. For that run the following commands on the terminal:  

# login MySQL
sudo mysql

In the MySQL shell, update root password with mysql_native_password plugin:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

mysql> FLUSH PRIVILEGES;
mysql> exit;

From now, we can log in to MySQL using the following command:

mysql -u root -p

The -p flag will prompt you for your MySQL user’s password to authenticate.

Install Composer 

To install Composer, we will use curl. So, make sure in your system curl is installed, and you can install curl using the following command:

sudo apt install curl

Now, run the following command to install Composer:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Now composer is installed, verify it by checking its version:

composer --version

Install Valet Linux+

Finally, require the package to install Valet Linux Plus:

composer global require genesisweb/valet-linux-plus

Now add the export PATH="$PATH:$HOME/.composer/vendor/bin" or export PATH="$PATH:$HOME/.config/composer/vendor/bin" to ~/.bash_profile or ~/.bashrc or ~/.zshrs.

Restart your terminal and run the valet install command.  

valet install

This will configure and install Valet Linux+, Nginx, MySql, Redis, Mailhog, and DnsMasq. It also registers Valet's daemon to launch when your system starts.

Once Valet Linux+ is installed, try pinging any *.test domain on your terminal.

ping -c1 foobar.test

If Valet Linux+ is installed correctly you should see this domain responding on 127.0.0.1. If not you might have to restart your system.

After completion of Valet Linux+, you’ll get all the Valet features including parklink, and status, etc.

For more information check out the Valet Linux+ documentation.

1

Please login or create new account to add your comment.

1 comment
SilasWorx
SilasWorx ·

Bro... thanks for this. Works perfect.

You may also like:

Laravel Pint & VS Code: Automate Your Code Formatting

Laravel Pint is an opinionated PHP code style fixer built on top of PHP-CS-Fixer, designed to simplify the process of ensuring clean and consistent code style in Laravel projects. (...)
Harish Kumar

Laravel Clockwork: A Deep Dive into Debugging, Profiling Skills and Best Practices

In the world of web development, building complex applications often comes with the challenge of identifying and resolving performance bottlenecks. This is where a reliable debugging (...)
Harish Kumar

Effortless PDF Generation in Laravel: A Guide to Using Spatie/Browsershot Package

Looking to generate or export PDF files using Laravel? Look no further! In this article, we'll guide you through using the Laravel spatie/browsershot package to seamlessly convert (...)
Harish Kumar

Part #3: Rule objects based custom validation in Laravel

Laravel comes with multiple ways to add custom validation rules to validate form request inputs. I have already explained some of the ways in the following article links:
Harish Kumar

Part #2: How to use Laravel's Validator::extend method for custom validation

Validation is important in any application as it validates a form before performing actions on it. It allows the user to know their input is accurate and confident about the operation (...)
Harish Kumar

Part #1: Closure-based Custom Laravel Validation

While I was working with Laravel, validation using closure came to my mind, and I know it will be helpful to you. This tutorial assists you with all what is the difference between (...)
Harish Kumar