Install/Upgrade Composer on Raspberry OS

To install/upgrade the Composer:

  • make sure you are in the home directory (cd ~)
  • download the installer
  • [optional] verify the installer (the line is commented, check the current hash from the Composer website)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Install composer globally using the following command and remove setup file:

php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer # to be able to call Composer from any directory (Global install)
php -r "unlink('composer-setup.php');"

To check:

composer

Source: Composer
Optional: How To Install and Use Composer on Ubuntu 20.04

Leave a Reply

Your email address will not be published.

Yandex.Metrica