Below are the steps to be followed to install composer globally:
1.
Before installing Composer, make sure our server has all dependencies installed.
1st, update the package manager cache by running:
$ sudo apt-get update
2.
Now, let's install the dependencies. We'll need
- curl => to download Composer
- php5-cli => installing and running it
- git => used by Composer for downloading project dependencies
Everything can be installed with the following command:
$ sudo apt-get install curl php5-cli git
3.
Composer installation with a single command:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
4.
This will download and install Composer as a system-wide command named composer, under /usr/local/bin. The output should look like this:
Output:
\#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
5.
To test your installation, run:
$ composer -V
Output:
Composer version 1.1.3 2016-06-26 15:42:08
- Installation Successful