How to update composer 1.6.3 to latest version 2.0.4?
I have tried to update my existing composer version in ubuntu.
and I try to check the version but ubuntu say package not found.
Then I again try sudo apt install composer
to install composer.
Now when I checked the composer's version. It shows 1.6.3 and if I try /home/alok/composer.phar
then the composer's version is 2.0.4.
I am confused. What should I do?
Please help me to solve this.
Remove the old composer
(the one in the repros):
sudo apt remove composer
There will remain a directory with preferences in your home folder. Move that out of the way:
mv ~/.composer ~/was-composer
Then, execute the four commands at the top of this page: https://getcomposer.org/download/
You now have a local version that you can run with php composer.phar
. To make it global, first make it executable, then copy it to a directory that lies on your $PATH:
chmod +x composer.phar
sudo mv composer.phar /usr/local/bin/composer
Now you can do composer require...
etc., from any directory.
In your terminal type:
composer self-update
or
composer selfupdate
It will be updated to the latest version.