# Install Laravel Valet+ on Ubuntu

> Set up the local Laravel environment we use: Nginx, PHP 8.2, MySQL, Composer and Valet+ on Ubuntu, plus phpMyAdmin on a secure .test domain.

*2026-09-17T03:23:45Z*

To get our projects running, we recommend using the same environment we use ourselves: Ubuntu Linux with Laravel Valet+. This guide takes you from a fresh machine to a working local setup with Nginx, PHP 8.2, MySQL, Composer, Valet+ and phpMyAdmin served on a secure `.test` domain.

_Note: this guide was written in October 2023 for PHP 8.2 and the `genesisweb/valet-linux-plus` package. Newer Ubuntu and PHP releases may need different package versions._

## Pick your Linux: BackBox (recommended)

I like to use [BackBox](https://www.backbox.org/download/) Linux because it comes with a lot of tools and supports our environment.

1. Download the ISO image from the BackBox link.
2. Write it to a USB stick using [Rufus](https://rufus.ie/en/).
3. Boot your computer from the USB stick and install it.

## Install the dependency packages

Open your terminal and start by adding the Nginx and PHP repositories and updating the system:

```bash
sudo add-apt-repository -y ppa:nginx/stable
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
```

```bash
sudo apt-get upgrade
```

When it finishes, reboot your computer, then install the packages Valet+ depends on:

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

## Install PHP and its extensions

Install PHP-FPM first:

```bash
sudo apt install php8.2-fpm
```

Then the CLI and the extensions a Laravel app needs:

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

## Install MySQL Server

1. Install the server:

```bash
sudo apt-get -y install mysql-server
```

2. Run the secure installation script:

```bash
sudo mysql_secure_installation
```

When it asks for the password validation level, choose `0`, then use any password, something like `12345678`.

3. When the installation is finished, open the MySQL console:

```bash
sudo mysql
```

4. In the MySQL console, set the root password so apps can log in with it, then reload the privileges and exit:

```sql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';
```

```sql
mysql> FLUSH PRIVILEGES;
```

```sql
mysql> exit;
```

## Install Composer

```bash
sudo apt install curl
```

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

## Install Valet+

1. Install the Valet+ package globally with Composer:

```bash
composer global require genesisweb/valet-linux-plus
```

2. Now you need to add Composer's global `bin` directory to your `PATH` so the `valet` command is found:

```bash
PATH="$PATH:$HOME/.composer/vendor/bin"
```

Or, depending on where Composer keeps its global packages, use this one:

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

3. Now it's easy to install Valet:

```bash
valet install
```

It will ask you for a password. Enter `12345678`, the MySQL password you set earlier.

## Install phpMyAdmin

With Valet installed, let's set up phpMyAdmin and serve it on a `.test` domain.

1. Create a folder for your sites in your home directory `~`:

```bash
cd ~
mkdir Sites
cd Sites
```

2. From inside `Sites`, park the directory so it becomes the home of your projects:

```bash
valet park
```

Every project in this directory is now served automatically on a `.test` domain.

3. Download phpMyAdmin from [phpmyadmin.net](https://www.phpmyadmin.net/), unzip it inside the `Sites` directory and rename the folder to `PHPMyAdmin`.

4. Go inside the folder, copy the sample config and open it:

```bash
cp config.sample.inc.php config.inc.php
nano config.inc.php
```

_Note: the original post copied the file to `config.sample.php`, which phpMyAdmin does not read. phpMyAdmin loads `config.inc.php`, so that name is used here._

5. Change the `blowfish_secret` line to:

```php
$cfg['blowfish_secret'] = 'YK07LhNSe50vrj,HwBfb.l3gpbv;u8b7';
```

6. Press `CTRL + X`, answer `Y` to save, then use Valet to link phpMyAdmin, secure it with SSL, and open it:

```bash
valet link
valet secure
valet open
```

phpMyAdmin is now running. Log in with `root` as the user and the MySQL password you created.

## Wrapping up

You now have the environment we use for our projects: Nginx and PHP 8.2 managed by Valet+, MySQL with a root password your apps can use, Composer, and phpMyAdmin on a secure `.test` domain. Put any new project in `~/Sites` and Valet serves it straight away.

---

Source: https://fadymondy.com/en/blog/install-laravel-valet-ubuntu
