Composer is a PHP dependency manager tool that helps in installing or updating packages or libraries in the system., In this tutorial, we will show you how to install and use composer on Linux Ubuntu 22.04 or 23.04 using a terminal or command line.
How to Install Composer on Ubuntu 22.04|23.04
To install Composer on Ubuntu, here are some steps using which you can easily install it in your Ubuntu 22.04 or 23.04 system.
- Step 1 – Update System APT Packages
- Step 2 – Install PHP and cURL
- Step 3 – Download Composer
- Step 4 – Install Composer
- Step 5 – Check Composer Version
Step 1 – Update System APT Packages
First of all, open the terminal or command line to execute the following command on the command line to update apt packages in Linux Ubuntu system:
sudo apt update
Step 2 – Install PHP and cURL
Now, execute the following command on command line or terminal to install PHP and cURL:
sudo apt install curl unzip sudo apt install php php-curl
Step 3 – Download Composer
Once installed curl by using the above command, Now, run this curl command on the terminal to download composer:
curl -sS https://getcomposer.org/installer -o composer-setup.php
Step 4 – Install Composer
Once the composer has been downloaded. After that, run the following command on the command line to install and set up composer on Linux ubuntu system:
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Step 5 – Check Composer Version
Finally, execute the following command on the command line to verify composer installation on linux ubuntu:
Through this tutorial, we have learned how to install and use Composer on Linux Ubuntu 22.04.
Recommended Linux Ubuntu Tutorials