, ,
Share On

Claps upto fifty times for each post.

30


Let’s install Laravel valet on ubuntu

Laravel Valet is a blazing-fast Laravel development environment for macOS. it configures your Mac always to run Nginx in the background when your machine starts.

– quoted from the official valet site.

This time we are going to install Laravel valet on an ubuntu machine. Thanks to Carlos Priego for making an excellent tool for non-apple users.

Before continuing to install, Valet for Ubuntu is a port of the original explicitly made for Ubuntu that attempts to mirror all the features of Valet v1 with the Caddy server.

Installation is super simple. First, make sure you are running Ubuntu >= 15.04 and continue with me.

“Apple user need bro. (brew) and sis 😜 . to install required apps. we don’t need this type of dependency to install things. let’s continue with terminal and make sure you have root access on this machine”

just kidding

let’s begin

first of all, open the terminal and install some required packages.

sudo apt install updatesudo apt install libnss3-tools jq xsel

to continue you have to install PHP and composer to finish the installation process. and make sure you have at least PHP 5.6 installed.
(if you have already installed PHP, composer and Nginx installed in your machine you can skip this step.)

installing PHP :


to install PHP on your machine run the below commands one by one

sudo apt install ca-certificates apt-transport-httpssudo apt install software-properties-commonsudo add-apt-repository ppa:ondrej/php -y


Next, upgrade any packages that require it.

sudo apt update && sudo apt upgrade -ysudo apt install php8.1 php8.1-fpm

install Ngnix


to install Nginx

run

sudo apt install nginx

we also need some extra packages to run valet properly

sudo apt install php8.1-cli php8.1-common php8.1-curl php8.1-json php8.1-mbstring php8.1-mcrypt php8.1-opcache php8.1-readline php8.1-xml php8.1-zip unzip

now, if we run PHP -v we will see like below screenshot

Validate PHP installation

we have the Nginx server, and PHP 8.1 installed on our machine.

install composer :


to install composer run the below commands one by one.

php -r "copy('https://getcomposer.org/installer', 'composer- setup.php');"


check file hash and continue to install

php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"


We will see the installer verified. Let’s install composer

php composer-setup.php


to access composer globally run

sudo mv composer.phar /usr/local/bin/composer

let’s check if the composer is installed properly
run composer -v

composer

install valet :


we have installed all of our required dependencies let’s install valet
to install valet,


first, run

composer global require cpriego/valet-linux


and then run

valet install

Sometimes you may face this issue Laravel “valet install” not found”
you need to make sure that the export path “~/.config/composer/vendor/bin” directory is in your system’s PATH; you can check this by running echo $PATH. To solve this issue, run this command below.

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

valet will ask for your root password to install the required package.
If everything is okay, you will see Valet installed successfully!
Congratulation! You achieved something great. Treat yourself.
Now you can use your server; open the directory in your terminal that you want to run with the server. Go to the project directory, Then run this command on the terminal.

valet park

The laravel valet server is parked. You might be prompted to enter your root password; simply input it and press Enter. Then it will appear as follows: You parked your project directory.

How to run projects on your server:
It’s very easy and no need to run every day. It will run automatically for you. Run your project in any browser on your Mac in this manner.

http://Your-project-name.test

Just one thing you have to ensure your projects is in the parked directory. If not, then just add it using the same command: valet park

Your server configuration is complete. You can run any PHP application using this server. If you face any problems, please leave a comment below.


3 responses to “Let’s install Laravel valet on ubuntu”

  1. Hasanuzzaman Avatar

    I was surprised to learn that because I was expected it to be more complicated. Thank you for your post.

    1. hasanmisbah Avatar

      Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

hasanmisbah Avatar

Click to follow this author!


Posts by this author


Posts related this

Share your local WordPress site.

AKM Elias

24 February 2024

Dynamic programming part – 1(Memoization)

AKM Elias

30 October 2022

Let’s install Laravel valet on ubuntu

hasanmisbah

27 September 2022

GitHub SSH key setup takes Five minutes.ďżź

Hasanuzzaman

14 September 2022

Programming and The Ad Hoc problems.

AKM Elias

28 August 2022