ItsmeITItsmeIT
  • Linux
    • Debian
    • Ubuntu
  • PC/Windows
Reading: How to Install Composer on Ubuntu 22.04/24.04
Share
Notification Show More
Font ResizerAa
ItsmeITItsmeIT
Font ResizerAa
  • Categories
    • Linux
    • Debian
    • Ubuntu
    • PC/Windows
Have an existing account? Sign In
Follow US
© 2025 ItsmeIT. All rights reserved.

Home » Linux » Ubuntu » How to Install Composer on Ubuntu 22.04/24.04

How to Install Composer on Ubuntu 22.04/24.04

avatar
By
Loibv
avatar
ByLoibv
The ItsmeIT team – delivering cutting-edge updates, tech trends, and insider knowledge from the world of technology.
Follow:
Last updated: March 23, 2025

As a PHP developer, I find Composer indispensable—it simplifies dependency management and makes it a breeze to work with popular frameworks like Magento 2, Laravel, and CodeIgniter. In this guide, we’ll walk you through the process of installing Composer on Ubuntu 22.04 and 24.04 LTS, ensuring you’re equipped to handle your PHP projects with ease.

What is Composer?

Composer is an application-level dependency manager for PHP. It provides a standardized way to manage the libraries and packages your PHP projects rely on. Developed by Nils Adermann and Jordi Boggiano, Composer has become a cornerstone of modern PHP development.

Prerequisites

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 install PHP versions. For cURL run the command below if you haven’t already.

sudo apt install curl

Install Composer on Ubuntu 22.04/20.04

Installing the Latest Version of Composer

To install the latest version of Composer on Ubuntu 20.04/22.04, use the following commands:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Installing a Specific (Older) Version of Composer

If you need to install a specific version of Composer to match your framework’s requirements, you can download and install it directly using the terminal with root privileges.

For example, to install Composer version 1.10.26 (required for Magento 2.4.1), you would run the following command (replace 1.10.26 with the version that suits your requirements):

sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.26

Verifying the Installation

I always make sure to verify my Composer installation by checking its version—this small step has saved me from debugging issues multiple times.

composer --version
Check composer version
Check composer version

This command should display the current version of Composer. If it doesn’t work, your $PATH environment variable may not be configured correctly. In that case, try using the full path:

/usr/local/bin/composer --version

If this works, you may need to add /usr/local/bin to your $PATH. You can do this by adding the following line to your ~/.bashrc or ~/.bash_profile file:

export PATH=$PATH:/usr/local/bin

Then, reload your shell configuration with command:

source ~/.bashrc 
# or
source ~/.bash_profile

You have now completed the steps to install Composer on Ubuntu. Personally, I’ve found that using Composer makes PHP dependency management much easier, saving me time and effort in every project.

Share This Article
Facebook Reddit Telegram Threads
avatar
ByLoibv
Follow:
The ItsmeIT team – delivering cutting-edge updates, tech trends, and insider knowledge from the world of technology.
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

Most Popular

install wordpress nginx
How to Install WordPress on Ubuntu 22.04/24.04 with Nginx, MariaDB, PHP8.2 (LEMP)
Scan Virus Ubuntu
3 Best Ways to Detect and Remove Malware on Ubuntu/Linux
boot virtualbox from usb
How to Boot from USB in VirtualBox on Ubuntu/Linux
Install SSL Localhost Ubuntu
How to Install SSL on Localhost in Ubuntu / Linux?
fix login error Gnome Online Accounts Ubuntu 22.04
How to Fix GNOME Online Accounts Login Issues on Ubuntu 22.04
Previous Next
ItsmeITItsmeIT
Follow US
© 2025 ItsmeIT. All Rights Reserved.
  • Privacy Policy
  • Terms of Service
Logo ItsmeIT logo
Welcome Back!

Sign in to your account

Continue with Google
Register   |Lost your password?