How to install Composer on 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.

In this tutorial, i am going to show you how to install and use composer on linux ubuntu 22.04.

How to install Composer on Ubuntu 22.04

Follow the below given 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 run the following command on command line to update apt packages in linux ubuntu system:

sudo apt update

Step 2 – Install PHP and cURL

Then run 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

Run 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 run 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 run the following command on command line to verify composer installation on linux ubuntu:

composer -V

Conclusion

Through this tutorial, i have shown to you how to install and use composer on linux ubuntu 22.04.

More Tutorials

Leave a Comment