[Linux] How to install Composer in CentOS 8
We need PHP and sudo permission to do that.
This is faster flow for installing composer.
Back# to install php cli and zip: sudo dnf install php-cli php-json php-zip curl unzip # using curl to get install and install it by using php curl -sS https://getcomposer.org/installer |php # move composer into your target sudo mv composer.phar /usr/local/bin/composerAnd the general flow here.
# To install php cli and other source
sudo dnf install php-cli php-json php-zip wget unzip
# Download composer-setup file
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# The following wget command will download the latest Composer signature from Composer’s Github page, and then store it as a variable named HASH.
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
# To verify whether the installation script is damaged, run the following command
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
# Verified result
Installer verified
# Move the installed composer to your target
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
# Check composer version
composer -V
Composer version 1.10.1 2020-03-13 20:34:27