How to Install Composer on RHEL/CentOS 7, 8

Published on September 14, 2020 41 sec read

Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.

In this article, we’re going to install composer on CentOS 7/8. Let’s start:

Table of Contents

  1. Installation
  2. Version Check
  3. Update Composer


At first, ensure that we’ve installed PHP by this command:

php --version

If PHP is not available on your machine, then please install PHP first. Then we need to install dependencies:

sudo dnf install wget -y # CentOS 8
sudo yum install wget -y # CentOS 7

Download the Composer installer script:

sudo wget -O composer-installer.php

Run the following command to install Composer in the /usr/bin directory:

sudo php composer-installer.php --filename=composer --install-dir=/usr/bin

You’ll set the output like:

All settings correct for using Composer

Composer (version  1.10.13) successfully installed to: /usr/bin/composer
Use it: php /usr/bin/composer

Verify the installation by typing:


Version Check

Run this command to see the current version of composer:

composer -V
composer --version

Update Composer

We can easily update composer to latest version. Just run this command:

composer self-update
That’s it. Thanks for reading. 🙂

Monthly Newsletter

One email a month, packed with the latest tutorials, delivered straight to your inbox.
We'll never send any spam or promotional emails.

Hey, I'm Md Obydullah. I build open-source projects and write article on Laravel, Linux server, modern JavaScript and more on web development.


2 Replies to “How to Install Composer on RHEL/CentOS 7, 8”

  1. Thanks a lot. This was very easy and actually worked.
    I had done it before but with other tutorials and had problems downloading the composer installer.
    Previously due to the problems with the download I had to download it to my pc, then upload the installer using ftp, rename it and finally when it was installed I had to add composer to the PATH because I couldn’t execute it completely.

    Not sure what was the problem but following this tutorial I had no problems.

Leave a Reply