Get 50% Discount Offer 7 Days


Contact Info

Chicago 12, Melborne City, USA

+88 01682648101

[email protected]

Composer on Ubuntu 20.04

Composer is used for dependency management in PHP and is generally created to facilitate the installation and updating of dependencies. The way Composer works is that it checks project packages and installs them according to the appropriate versions and based on the user’s project configuration. So, this article shows how you can install Composer in Ubuntu 20.04.


Here are the requirements before installing Composer on Ubuntu 20.04:

  • Up-to-date Linux VPS with Ubuntu OS.
  • Root or a user with sudo privileges

4 Steps to Install Composer on Ubuntu 20.04

You can use Composer in all modern PHP frameworks and platforms like Laravel or Drupal. Let’s examine a simple and complete guide to have this great tool on Ubuntu on our Linux VPS or operating system.

composer installation

Step1: Updating the System

Before you start the installation, update your system, so, open the terminal, and run these commands:

sudo apt update
sudo apt upgrade

Tip: An administrative computer runs these commands, so, you have to enter your system password.

Step 2: Install Required Dependencies

Composer depends on some essential packages, including curl and php-cli Install them by executing the following command:

sudo apt install curl php-cli

Step 3: Download and Install Composer

You can install Composer on Ubuntu with just one command line. To do this and install the required files from the official Composer website, use the curl tool, so that this tool will be installed on your system:

curl -sS -o composer-setup.php

After a successful installation process, you will receive a message indicating that your installation was successful:


Step 4: Verify the Installer

Before proceeding, it’s always a good practice to verify the integrity of the installer script. You can achieve this by using SHA-384 verification with the following command:

HASH="$(curl -sS"

Verify the signature by running:

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

If the installer is verified, you should see the message: installer verified.

Step 5: Install Composer Locally

To install Composer locally for a specific user, run the following command:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Step 6: Enable Global Access to Composer

To enable Composer globally, allowing it to be accessed from any directory, use the following command:

sudo mv composer.phar /usr/local/bin/composer

Step 7: Verify the Installation

You can verify the successful installation of Composer by running the following command:

composer --version
verify composer installation


In summary, here you have learned how to install Composer on Ubuntu 20.04 and test it correctly. Read all the steps carefully to have a successful installation and enjoy using this great assistant. If you have any questions or problems, you can share them with us in the comments section. Share this blog with sone who need it.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *