Using Laravel Valet On Linux/Ubuntu! 🐘 🔑
Andrew Brooks 👨‍💻

Andrew Brooks 👨‍💻 @andrewbrooks

About: Full Stack Software Developer // #laravel is ♥️ I'm Andrew. Building things with code is my jam. Check out some of my writing or say hi!

Location:
Mobile, AL
Joined:
May 30, 2019

Using Laravel Valet On Linux/Ubuntu! 🐘 🔑

Publish Date: Nov 21 '19
19 3

Valet is an elegant way to create a local webserver for testing your Laravel applications on Mac.

Fortunately there is a fork allowing us to use Valet on a Linux based OS as well thanks to @cpriego.

Let's get started.

Helpful Links

Prerequisites

Installing Dependencies

sudo apt-get install php7.3-curl
sudo apt-get install jq
sudo apt-get install xsel
sudo apt-get install libnss3-tools

Installing Valet

composer global require cpriego/valet-linux
test -d ~/.composer && bash ~/.composer/vendor/bin/valet install || bash ~/.config/composer/vendor/bin/valet install

Restart your terminal

Serving your project

cd into project root and run the following command

valet park

The web URL generated will be {project_folder_name}.test.

For example:

laravel new blog

cd blog

valet park

will provide a working URL of blog.test

Things to remember

If you have a local Apache serve running you need to disable it or your Valet URLs will lead to the Apache welcome page.

sudo systemctl stop apache2
sudo systemctl disable apache2

To un-park a project cd into the root and run

valet forget

I'm Andrew, a full stack software developer from the deep south who makes internet things.

Hit me up on twitter @andrew_brooksie

Reach out if you have any questions or requests for future write-ups!

Comments 3 total

  • Sahil kashyap
    Sahil kashyapApr 12, 2020

    Also if you want to restart the apache2(I had difficulting while restarting apache)

    1. Turn off the nginx
    sudo service nginx stop
    
    1. Then enable the apache
    sudo systemctl enable apache2
    
    1. then
    sudo systemctl start apache2  
    

    or

    sudo systemctl restart apache2  
    
  • Riliwan
    RiliwanMay 9, 2020

    is valet php.ini different from the local system's ?

  • Pranoy Sinha
    Pranoy SinhaFeb 17, 2024

    Does it work on PHP8.1 on Ubuntu22.04 LTS till today, 17Feb2024. I have tried but no luck. Can anyone pls help me? TIA.

Add comment