Updating $PATH for Laravel in Ubuntu 20.04

In order to get #laravel command to work make sure its included in the $PATH

$ composer global require laravel/installer
Changed current directory to /home/admin/.config/composer
Using version ^4.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-php80 (v1.18.1): Downloading (100%)         
  - Installing symfony/process (v5.1.5): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.18.1): Downloading (100%)         
  - Installing symfony/polyfill-intl-normalizer (v1.18.1): Downloading (100%)         
  - Installing symfony/polyfill-intl-grapheme (v1.18.1): Downloading (100%)         
  - Installing symfony/polyfill-ctype (v1.18.1): Downloading (100%)         
  - Installing symfony/string (v5.1.5): Downloading (100%)         
  - Installing psr/container (1.0.0): Downloading (100%)         
  - Installing symfony/service-contracts (v2.2.0): Downloading (100%)         
  - Installing symfony/polyfill-php73 (v1.18.1): Downloading (100%)         
  - Installing symfony/console (v5.1.5): Downloading (100%)         
  - Installing laravel/installer (v4.0.4): Downloading (100%)         
symfony/polyfill-intl-normalizer suggests installing ext-intl (For best performance)
symfony/polyfill-intl-grapheme suggests installing ext-intl (For best performance)
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files
10 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Notice the command is still not available

$ laravel
laravel: command not found



$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

That’s because you need to update the path in /etc/environment , using vi or nano edit this file and append the path details

$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/admin/.config/composer/vendor/bin"

Final step is to source /etc/environment so that it can be read into your current session

$ source /etc/environment

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/admin/.config/composer/vendor/bin

$ laravel
Laravel Installer 4.0.4

RELATED POST

Veritas Volume Manager: Growing a disk group and expand the filesystem

Validated by Mr Man! Lets start off on node2 [root@node02 ~]# vxdisk list DEVICE TYPE DISK GROUP STATUS sda auto:none…

Virtual Machine Manager: Error starting domain

Starting up the KVM error occurred Error starting domain: Requested operation is not valid: network 'default' is not active Locate…

Git Commands

How to initialize a Git repo: Everything starts from here. The first step is to initialize a new Git repo…

Lab Hack: Raspberry Pi running VMWare ESXi

As strange as the title sounds, yes I am running VMWare ESXi on a Raspberry Pi 4 Model B (4GB)…