Install composer on ubuntu 20.04

To quickly install composer on ubuntu 20.04 you want to run the following commands. Make sure you are in your own home directory.

  • sudo apt install wget php-cli php-zip unzip -y
  • wget -O composer-setup.php https://getcomposer.org/installer
  • sudo php composer-setup.php –install-dir=/usr/bin –filename=composer

Look at the –install-dir=/usr/bin. A lot of guides tell you to install it into the directory /usr/bin/local

I did that at first which gave me the error:

-bash: /usr/bin/composer: No such file or directory 

If you also get this error simply move the composer file from your /usr/bin/local to /usr/bin/ with the following command.

  • mv /usr/bin/local/composer /usr/bin/composer

 

Published
Categorized as ubuntu

Leave a comment

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