Today, We will discuss about how to install composer on Ubuntu 16.04 and 18.04. Ubuntu is a free and open-source operating system and it is a popular operating system for cloud computing.

Introduction Composer

The composer is a package manager libraries. it is managing the PHP application and it is used for specially laravel framework. let’s see the below example.

Install Dependencies for Composer

The PHP version must be installed to 5.3.2 or higher version for the installation composer. PHP stands for Hypertext Preprocessor and it’s a run based on server-side. so we need to install apache server MySQL and PHP. if you didn’t install PHP in your system then you can install through the below article URL.

Install Composer on Ubuntu

We will download the composer using the below command.

sudo apt-get update
sudo apt-get install curl
sudo curl -s https://getcomposer.org/installer | php

Now we move the composer.phar file into the bin folder and set the permission for all users.

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

check composer installed or not ubuntu

After the installation composer, we will check the composer is installed or not using the below command.

composer
/ ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.8.6 2019-09-03 23:17:20

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
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.

Update Composer on Ubuntu

If you have already downloaded or installed the composer and you want to update the composer on ubuntu then you can below command.

sudo composer self-update