DWQA QuestionsCategory: PHPInstall composer in ubnutu 16.04 ?
asked 6 years ago

Answer : 
Step 1:
Run

$ sudo apt-get update

If this was not done before.
Step 3:
Install wget for file download in ubuntu

$ sudo apt-get install wget

Step 2:
Download the composer.phar from https://getcomposer.org/download via wget or built-in curl

$ wget https://getcomposer.org/composer.phar

or

$ curl -O https://getcomposer.org/composer.phar

 
** -O is capital O not Zero(0)
Step 3:
Rename composer.phar to composer

$ mv composer.phar composer

Step 4:
Make composer executable

$ chmod +x composer

Step 5:
Now composer can be run locally through

$ ./composer

But this is available where you are i.e. current directory where the composer file is.
Step 6:
Make composer available globally move it to /user/local/bin by

$ sudo mv composer /usr/local/bin

Now composer will be available anywhere by simply

$ composer