https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04

• sudo apt update

• sudo apt install php-cli unzip

• cd ~

• curl -sS https://getcomposer.org/installer -o composer-setup.php

• HASH=`curl -sS https://composer.github.io/installer.sig`

• echo $HASH

Output

e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a

• php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Installer verified

• sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Output

All settings correct for using Composer Downloading...

Composer (version 1.10.5) successfully installed to:

/usr/local/bin/composer

Use it: php /usr/local/bin/composer To test your installation, run:

• composer

• Output

摘录
计算机