How To Install Composer On Ubuntu 20.04 LTS

Tutorial To Install Composer On Ubuntu 20.04 LTS

In this Linux composer guide, we’ll install Composer on an Ubuntu 20.04 LTS.

How To Install Composer On Ubuntu 20.04 LTS

Run the following commands to install the required dependencies at first:

sudo apt update
sudo apt install php-cli unzip

Now, We are downloading and installing the Composer with the following commands:

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

Run the following commands if you want to verify the installed composer:

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

You need to execute the following PHP code to verify that the Composer installer.

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

Now, Install composer on Ubuntu 20.04 LTS with the following command:

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

 
Run the following command to test your installation:

composer 
READ More Relevant Stuff:  How To Set JAVA_HOME Environment Variable On Ubuntu 22.04

Leave a Reply

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