Download and Install Composer on Linux | Drupal 8

Download and Install Composer on Linux

Submitted by editor on Thu, 07/20/2017 - 11:29
Question

How to install Composer on Linux (Debian, Ubunto, Mini ...)

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Download Composer

Link : https://getcomposer.org/download/

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Note : For the security, you can check the setup file using SHA hash.
Fot that, get the latest version from https://getcomposer.org/download
Example :
#php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Move composer to bin

Make `composer` executable as a command from anywhere. Destination can be anywhere on $PATH.

mv composer.phar composer
chmod +x composer
sudo mv composer /usr/local/bin

Check composer version

composer --version

Now you can use composer form anywhare

Follow this tutorial to install drupal via composer

Tags

Add new comment