How to Install Composer on RHEL/CentOS 7, 8
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
At first, ensure that we’ve installed PHP by this command:
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 https://getcomposer.org/installer -O composer-installer.php
Run the following command to install Composer in the
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:
Run this command to see the current version of composer:
We can easily update composer to latest version. Just run this command:
That’s it. Thanks for reading.
Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.