Install Composer on Ubuntu 22.04

This tutorial will show you how to install composer on a ubuntu machine. To get composer running, you need at least php-cli and unzip

sudo apt install php-cli unzip

After that, you go to your home directory and download the installer to your tmp folder:

cd ~
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php

After you download the installer, you can run it with the following command. This will create an executable in your local binary folder and you can use composer anywhere.

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

Test your installation:

composer

Composer is now installed on your system.