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('', 'composer-setup.php');"
# php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { 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:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"

To check:


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

Leave a Reply

Your email address will not be published.