Share the steps of installing Composer in Linux

  • 2021-07-26 09:11:17
  • OfStack

1. Download the installation script-composer-setup. php-to the current directory


php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"

2. Perform the installation process


php composer-setup.php

3. Remove the installation script


php -r "unlink('composer-setup.php');"

4. Global Installation


sudo mv composer.phar /usr/local/bin/composer ( ubuuntu:/usr/bin/composer ) 

Note: Before installation, make sure php is installed correctly (check: php-v check version number), keep composer version update command: composer selfupdate

Supplement

Global Installation Method of composer under Linux

/Download composer

curl -sS https://getcomposer.org/installer | php

//Move the composer. phar file to the bin directory for global use of the composer command

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

//Switch domestic sources

composer config -g repo.packagist composer https://packagist.phpcomposer.com


Related articles: