Install Laravel Valet Linux+ development environment on Ubuntu System

Harish Kumar · · 1511 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:

What are Laravel Macros and How to Extending Laravel’s Core Classes using Macros with example?

Laravel Macros are a great way of expanding Laravel's core macroable classes and add additional functionality needed for your application. In simple word, Laravel Macro is an (...)
Harish Kumar

How To Install NVM (Node Version Manager) on Ubuntu System?

This tutorial will assist you with installing NVM on the Ubuntu machine. Additionally, allow you to install different node versions and other useful examples.
Harish Kumar

Install phpMyAdmin Manually with Nginx server on Ubuntu

In this guide, I will show you how to install and configure phpMyAdmin with Nginx, MySQL, and PHP8.0 (LEMP) on an Ubuntu system. phpMyAdmin is a free and open-source database (...)
Harish Kumar

Laravel Sanctum API Token Authentication Tutorial with example

Laravel Sanctum is a popular package for API Token Authentication. There are many other packages available to authenticate the APIs request in Laravel. For example, We are already (...)
Harish Kumar

Create SPA authentication Using Laravel Sanctum and Vue.js

In this guide, we will focus on SPA authentication in a simple Vue.js app using Laravel Sanctum. Laravel Sanctum provides a featherweight authentication system for SPAs (single (...)
Harish Kumar

Install and Setup Oh-My-Zsh on Ubuntu System

In this post, I will show you how to install ZSH (Z-Shell). Then, we set up the oh-my-zsh framework for managing ZSH. We will likewise show you how to change the ZSH theme and (...)
Harish Kumar