How to Install Composer on Debian 10

Install Composer on Debian 10

In this article, we will have explained the necessary steps to install and configure Composer on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Composer is a best dependency manager for PHP. Composer can install, update and pull in all the required PHP packages to your project directory. At the time of installing package, composer will check for dependencies of package and if dependent package are there then it will also install dependencies.

Install Composer on Debian

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install Composer.

First, download and install Composer by executing the following command:

curl -sS https://getcomposer.org/installer | php

Copy composer.phar file under bin directory to make available anywhere in the system. Also, set the execute permission on file. I have changed the filename from composer.phar to composer to easy use:

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

This will provide you composer version details along with options available with composer command:

composer

The above command will print details as following:

______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.8.5 2019-09-09 16:46:57

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output

To learn more about Composer and find out how to get started with using this package manager, our recommendation is to read the official documentation at https://getcomposer.org/doc/.

Congratulation, you have learned how to install and configure Composer on Debian 10 Buster. If you have any question, please leave a comment below.