How to Install Composer on CentOS 8

Install Composer on CentOS 8

In this article, we will have explained the necessary steps to install and configure Composer on CentOS 8. 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 one the best dependency management tool for PHP which can install and update project dependency seamlessly. When installing a package it also checks on which another package current package depends on and then it installs all the dependencies.

Install Composer on CentOS

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

Step 2. Install Dependencies packages.

Now, we need to install php related packages using dnf:

Step 2. Install Composer on CentOS 8.

We can download the Composer installer with php:

You can verify that the installer matches the SHA-384 hash for the data integrity of latest installer found on the Composer Public Keys:

Check if installation script is corrupted using command:


Then, run following command to install Composer globally inside /usr/local/bin directory:

Run the following command to confirm the installation:

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

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