install composer ubuntu 20.04 code example

Example 1: ubuntu install composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Example 2: composer install ubuntu

sudo curl -s https://getcomposer.org/installer | phpmixed

Example 3: install composer on ubuntu 20.04

# download composer.phar to /usr/bin and symlink composer to composer.phar
pushd /usr/bin >/dev/null &&
sudo wget -O composer.phar https://getcomposer.org/composer-stable.phar &&
sudo chmod 755 composer.phar &&
sudo ln -fs composer.phar composer &&
popd >/dev/null

Example 4: install composer in ubantu 20

cd ~
curl -sS https://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer