Install Composer on Ubuntu 22.04 or Linux-based operating systems is relatively simple with just a few command lines. However, selecting the precise Composer version according to project requirements, such as Magento 2.3 requiring Composer 1.10.26 or Laravel requiring the latest version, can be crucial.
So, how do you ensure the accurate installation of specific Composer versions? You can find the step-by-step guide in our article.
Install Composer on Ubuntu 22.04 Latest Version
To be able to install composer on Linux in general or Ubuntu and Debian in particular, you first need to successfully install PHP and cURL, you can refer to the instructions for installing PHP versions. For cURL run the command below if you haven’t already.
sudo apt install curl
curl -sS https://getcomposer.org/installer -o composer-setup.php
Next, run the following command to install Composer:
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Check if Composer is installed correctly by running:
composer --version
You can also visit the composer official page to learn more about the instructions.
Install Composer with Specific Version
If you want to install Composer with lower versions to match the Framework then scroll down and find the right version, download it and copy it to /usr/local/bin
, or run the command on terminal with root privileges. For example, here I will install composer 1.10.26 to run Magento 2.4.1 (replace 1.10.26 with the version that suits your requirements).
sudo -s
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.26
Above are the steps on how to install Composer on Ubuntu 22.04 & Linux debian so you can manage Framework projects that require Composer, if you have questions, please leave a comment below.
– Advertising –