Hello, friends. Long time no write. This time, I will show you how to install PHP Composer on Rocky Linux 8. PHP Composer is a fundamental tool for PHP, so it is always useful to know how to install it quickly.
Quickly what is PHP Composer?
One of the examples where the usefulness of Composer is best shown is when our project depends on many external libraries. Thanks to Composer, we will be able to add them, to eliminate them and to update them in a fast and simple way.
The operation of PHP Composer is quite similar to the one we give to the package managers for Linux, like APT or DNF.
So, we need a tool that can be used to install libraries and manage PHP application dependencies. And for that, it is better than PHP Composer. Let’s go for it.
Install PHP Composer on Rocky Linux 8
The installation of Composer is basic on a system like Linux. But before we start, we have to install some necessary packages like
wget and others.
sudo dnf install wget nano unzip
You also have to install PHP as the base programming language of Composer. For this, you don’t need to install many PHP modules, just the base package.
sudo dnf install php-cli php-json php-zip
After the dependencies are installed in the system, we can download the PHP Composer installer to our system without any problems.
Now, it is necessary to use the
wget command to download PHP Composer.
wget https://getcomposer.org/installer -O composer-installer.php
Now perform the installation by running the following command
sudo php composer-installer.php --filename=composer --install-dir=/usr/local/bin
You will get an output screen like the following;
All settings correct for using Composer Downloading... Composer (version 2.2.5) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer
As we have installed Composer in a location that is in system path, we will be able to use it without issues at once.
Proof of this is that you can show the version that we have installed
composer -V Composer version 2.2.5 2022-01-21 17:25:52
This is how easy it is to install Composer on Rocky Linux, which is a robust system that is being used by more and more developers all over the world.
In this post, you have learned how to install PHP Composer on Rocky Linux 8 easily and simply through a series of steps. This PHP dependency manager is vital for many developers and serious projects.