Install Composer Globally

How to install Composer globally for all users.

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
which composer
touch /etc/profile.d/add_user_local_bin.sh; echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile.d/add_user_local_bin.sh;

Example:

[root@server:~]# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 1.9.3) successfully installed to: /root/composer.phar
Use it: php composer.phar

[root@server:~]# mv composer.phar /usr/local/bin/composer
[root@server:~]# which composer
/usr/local/bin/composer
[root@server:~]# touch /etc/profile.d/add_user_local_bin.sh; echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile.d/add_user_local_bin.sh;
[root@server:~]# which composer
/usr/local/bin/composer
[root@server:~]# /usr/local/bin/composer
Do not run Composer as root/super user! See https://getcomposer.org/root for details
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.9.3 2020-02-04 12:58:49