Install and use composer on linux ubuntu 22.04; Through this tutorial, we will learn how to install and use composer on linux ubuntu 22.04.
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
How to install Composer on Ubuntu 22.04
Use the following steps to install and use composer on linux ubuntu 22.04:
- Step 1 – Run APT Update
- Step 2 – Install PHP and cURL
- Step 3 – Download Composer on Ubuntu 22.04
- Step 4 – Use the PHP to install Composer
- Step 5 – Check Composer Version
Step 1 – Run APT Update
First of all, open terminal and execute the following command on command line to update apt packages in linux ubuntu system:
sudo apt update
Step 2 – Install PHP and cURL
Then execute the following command on command line to install PHP and cURL:
sudo apt install curl unzip sudo apt install php php-curl
Step 3 – Download Composer on Ubuntu 22.04
Execute the following command on command line to download composer using curl:
curl -sS https://getcomposer.org/installer -o composer-setup.php
Step 4 – Use the PHP to install Composer
Once the composer has been downloaded, then execute the following command on command line to install and setup composer on linux ubuntu system:
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Step 5 – Check Composer Version
Then execute the following command on command line to verify composer installation on linux ubuntu:
composer -V
Conclusion
Through this tutorial, we have learned how to install and use composer on linux ubuntu 22.04.
Recommended Linux Ubuntu Tutorials