By | February 29, 2020

how too install composer banner

Composer is a command-line package manager for the PHP programming language. Composer helps in managing dependencies and libraries that are required when developing PHP applications.

So if you’re developing a PHP app and you need some third-party libraries you can declare them in the “composer.json” file; while composer will go ahead to install the libraries and update them for you as necessary.

These packages are installed in a directory like “vendor within your project directory

Composer will manage the libraries of different PHP projects individually; because definitely different project need different packages or even none at all.

In this post, I would show you how you can install composer on Ubuntu Linux. Similar steps can be followed with other distros of Linux.


For you to be able to run/use composer you must have PHP (version 5.3.2 and above) installed in your system.

Check here on how to install PHP on your system.

Step 1 – Update systems software repositories:

Use the command:

sudo apt-get update

Step 2 – Then go to the home directory:

cd ~

Step 3 – Download composer:

curl -sS -o composer-setup.php

Step 4 – Verify the installer

Now verify that the installer you just downloaded is the same with the latest version using the SHA-384 hash.

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

If successful, you should have a “Installer verified” as output.

composer install commands
Composer installation commands.

Step 5 – Install composer:

There are two ways to install Composer. Locally as part of your project, or globally as a system wide executable. Except on very important reasons, it is advisable to install it globally on your system. And thats what we will do here (i.e. In the /usr/local/bin directory);

sudo php composer-setup.php --install-dir=/usr/loacal/bin --finame=composer

The output should look like this;

MUST READ  Linux installation: Dual-booting with Windows 7

All settings correct for using Composer


Composer (Version 1.8.6) successfully installed to: /usr/local/bin/composer

Use it: php /usr/local/bin/composer

You can type this command to launch composer:


You should see this:

running composer
Composer output.

There you have it, composer installed in your system.

Happy Linux’NG!

I agree to have my personal information transfered to MailChimp ( more information )
Join over 10,000 visitors to receive Open Source tips, trick, news, tutorials, programming and more.
We hate spam. Your email address will not be sold or shared with anyone else.

Tell us what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.