Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu - Install Composer

Manual Installation (Current Preferred)

Install composer manually with the chained command below to ensure you have the latest version, which you may need to do if you are using PHP 8.

sudo apt update \
  && sudo apt install curl -y \
  && curl -sS https://getcomposer.org/installer | php \
  && sudo mv composer.phar /usr/bin/composer \
  && sudo chmod +x /usr/bin/composer

Alternatively you can install through prog-exec:

prog-exec "21/1" "9821b9b31fecd498b8454eed4331e1048ffd51c48dfc906e3707bbdd43665830"

Native Packages

You can now install composer using the local ubuntu packages with:

sudo apt update
sudo apt install composer -y

Now you can run all the composer commands from any directory, such as:

composer update
Last updated: 28th February 2022
First published: 16th August 2018

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch