Install and Use Composer on Ubuntu

Step 1 – Update Dependencies

sudo apt update

Step 2 – Download and Install Composer

cd ~
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php

Step 3 – Verify Installer Signature

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

Example Output:

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

Output:

Installer verified

Step 4 – Install Composer Globally

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

Example Output:

All settings correct for using Composer
Downloading...

Composer (version 2.3.5) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Step 5 – Verify Composer Installation

composer

Output:

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 2.3.5 2022-04-13 16:43:00

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Help ? Call Our award-winning support team 24/7 at 01-4983900

© 2023 All right reserved to sobiztrend.com