sudo apt-get remove composer
- Download the installer to the current directory
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- Verify the installer SHA-384, which you can also https://getcomposer.org/download/
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- Run the installer
php composer-setup.php
Remove the installer
php -r "unlink('composer-setup.php');"
sudo apt install composer
Refderences:
https://getcomposer.org/download/
sudo composer self-update
-------------------------------------------------------------------------------
composer install error
sudo apt install wget php-cli php-zip unzip
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
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
All settings correct for using Composer
Downloading...
Composer (version 2.0.14) successfully installed to:
/usr/local/bin/composer
Use it: php /usr/local/bin/composer