Published on

Composer install or Update on Ubuntu

  • avatar
    Md Rathik

Composer install or Update on Ubuntu

If you are already on the LAMP stack, then this post will help to quickly set up the composer. Spacially for the version which hasn't self-update available. Let's get started.

You can check if the composer is already available on your computer by this command,
$ which composer

in this case, my computer returns**/usr/bin/composer .** if there is nothing return like mine. Don't worry just follow the steps below.

To download Composer

it will download the composer in current directory.

php -r "copy('','composer-setup.php');"

TO Create composer.phar

it will create this in same (Current) directory.
php composer-setup.php

Final step to move the composer.phar

Replace /usr/bin/composer with the result returned from step 1. after this you are able to run composer globally.

sudo mv composer.phar /usr/bin/composer

If it's successfully installed, the output will be the same as the screenshot below.

composer screenshot

Banner Image credit:Ben