Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save zunayed-arp/80ba8611a88623c20f9bb6c7b4e25792 to your computer and use it in GitHub Desktop.

Select an option

Save zunayed-arp/80ba8611a88623c20f9bb6c7b4e25792 to your computer and use it in GitHub Desktop.
How to install Laravel globally in Ubuntu

How to install Laravel globally in Ubuntu

===================================================================

Open your terminal using Ctrl+Alt+T and type the following commands

Step 1: Install Laravel

composer global require "laravel/installer"

Step 2: Add composer to path to access laravel globally

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

Step 3: Create a new Laravel application

laravel new blog

Step 4: Install missing packages and their dependencies

cd blog
composer install

Step 5: Test the application

php artisan serve

Open a web browser and visit localhost:8000 to see the laravel welcome page

Step 6: Stop server

Terminate php server in terminal by pressing Ctrl+C

Thus you have successfully installed laravel globally.

@luscas
Copy link
Copy Markdown

luscas commented Aug 21, 2019

$ export PATH="~/.composer/vendor/bin:$PATH"

works for me

@mostafababaii
Copy link
Copy Markdown

$ export PATH="~/.composer/vendor/bin:$PATH"

works for me

it works for me too, thanks bro.

@fajri-isnanto
Copy link
Copy Markdown

export PATH="~/.config/composer/vendor/bin:$PATH"
thank u so much is working on my directry
.config/composer/vendor/bin
niceee

@faiqueimtiaz
Copy link
Copy Markdown

I ran into the command
export PATH="~/.config/composer/vendor/bin:$PATH"
and that worked but, this command is to be run everytime to run laravel new blog globally.
please help

@habeeb03
Copy link
Copy Markdown

I ran into the command
export PATH="~/.config/composer/vendor/bin:$PATH"
and that worked but, this command is to be run everytime to run laravel new blog globally.
please help

Run export PATH="$PATH:~/.composer/vendor/bin"
then run source ~/.bashrc

@WARHORSE-PRO
Copy link
Copy Markdown

$ export PATH="~/.composer/vendor/bin:$PATH"

works for me

it works for me too, thanks bro.

Worked for me 2

@EduardoMtz94
Copy link
Copy Markdown

EduardoMtz94 commented Apr 26, 2020

$ export PATH="~/.composer/vendor/bin:$PATH"

works for me

Worked for me, just I had to put $HOME instead of ~

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

@wesleymontaigne
Copy link
Copy Markdown

Thanks a lot man !!!

@fdangelo330
Copy link
Copy Markdown

export PATH="$HOME/.composer/vendor/bin:$PATH"
I have added this line to ~/.bashrc on Ubuntu 18.04.
It worked for me.

@wesleymontaigne
Copy link
Copy Markdown

Thanks

Copy link
Copy Markdown

ghost commented Aug 11, 2020

thank youuuuuuuuuuuu

@noor-ul-amin0
Copy link
Copy Markdown

Hey! How can I set this PATH in window 10? I am can't set PATH in windows.

@noor-ul-amin0
Copy link
Copy Markdown

Basically I've installed Laravel 8.0.1 through composer globally after that I don't know how to set PATH for it.

@paulomatosx
Copy link
Copy Markdown

After step 2 the command Laravel work, but if I close the terminal, open a new terminal and type the command
laravel not work more(bash: laravel:comando not found),
then I resolve this in my ubuntu 20.04 follow this steps:
https://stackoverflow.com/questions/61395786/i-get-laravel-command-not-found-on-ubuntu-20-04

@Jomooto
Copy link
Copy Markdown

Jomooto commented May 13, 2021

thanks

@priana13
Copy link
Copy Markdown

priana13 commented Jun 26, 2021

Thanks, it's work. I use Ubuntu 20.4

@gordonnchy
Copy link
Copy Markdown

It works fine, Thank you

@Haris-Noori
Copy link
Copy Markdown

Thanks, it worked for me!

@king-kanda
Copy link
Copy Markdown

thanks for this

@JNRivadeneira
Copy link
Copy Markdown

Funciona en Ubuntu 21.04. Gracias !!
It works on Ubuntu 21.04 Thank you! :)

@tiagopimentta
Copy link
Copy Markdown

thx gui!

@erkdgn
Copy link
Copy Markdown

erkdgn commented Jan 7, 2022

Thanks!

@MostafaAlaeddin
Copy link
Copy Markdown

💯 👍

@meetwitchukx
Copy link
Copy Markdown

In my case, I had already installed Composer and Laravel using
$ composer global require laravel/installer
but Laravel was not available at the terminal.
Using the following worked for me:
$ export PATH="~/.config/composer/vendor/bin:$PATH"

Thanks a lot!

@meetwitchukx
Copy link
Copy Markdown

meetwitchukx commented Jul 15, 2022

Install Laravel

composer global require laravel/installer

composer global require "laravel/installer"
Edit environment config,

nano .bashrc

Then add,

export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Then reload path config,

source ~/.bashrc

That finally worked.

@Noxxe-0001
Copy link
Copy Markdown

Is there anyway to only create the projects using the larvel 9 installer rather than the latest one.

@edglz
Copy link
Copy Markdown

edglz commented May 4, 2023

Thanks!

@govind663
Copy link
Copy Markdown

I extend my heartfelt gratitude for your invaluable guidance. Your wisdom and support have illuminated my path, making a profound impact on my journey. Thanks to your insights, I feel better equipped to navigate challenges and pursue success. Your generosity in sharing knowledge is truly appreciated. I am fortunate to have you as a mentor.

@ronald-kimeli
Copy link
Copy Markdown

Install Laravel

composer global require laravel/installer

composer global require "laravel/installer" Edit environment config,

nano .bashrc

Then add,

export PATH="$PATH:$HOME/.config/composer/vendor/bin" Then reload path config,

source ~/.bashrc

That finally worked.

While Using zshell

sudo nano ~/.zshrc

then add line above at the end then refresh

sudo source ~/.zshrc

@matos-julio
Copy link
Copy Markdown

Thank you! Works fine for me on ubuntu 24.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment