Tuesday, June 7, 2022

Steps to install Composer ubuntu 20.4

 

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
 
  1. sudo apt install wget php-cli php-zip unzip
  2. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  3. HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
  4. 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
  1. 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
 

No comments:

Post a Comment