Install PHP Composer on Ubuntu: Difference between revisions
From WikiMLT
m Стадий: 6 [Фаза:Утвърждаване, Статус:Утвърден]; Категория:PHP |
mNo edit summary |
||
Line 1: | Line 1: | ||
<noinclude>{{ContentArticleHeader/Linux Server|toc=off}}{{ContentArticleHeader/PHP}}</noinclude> | <noinclude>{{ContentArticleHeader/Linux Server|toc=off}}{{ContentArticleHeader/PHP}}</noinclude> | ||
== | == Update 2022 == | ||
'''The instructions below may be deprecated! Because the instructions will change with every version of the installer... Instead, please visit the page https://getcomposer.org/download/ and follow the steps provided there!''' | |||
If Composer is already installed on your system - i.e. <code>/usr/local/bin/composer</code> - you can update it by the following command command :<syntaxhighlight lang="shell" line="1"> | |||
sudo composer self-update | |||
</syntaxhighlight><syntaxhighlight lang="bash"> | |||
Upgrading to version 2.5.1 (stable channel). | |||
Use 'composer self-update --rollback' to return to version 2.4.4 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Install the latest version of Composer | == Install the latest version of Composer == | ||
<syntaxhighlight lang="shell" line="1"> | <syntaxhighlight lang="shell" line="1"> | ||
sudo apt update | sudo apt update | ||
Line 26: | Line 28: | ||
*Digital Ocean: [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04 How To Install and Use Composer on Ubuntu 20.04] | *Digital Ocean: [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04 How To Install and Use Composer on Ubuntu 20.04] | ||
<noinclude> | ==Install Composer via Apt== | ||
<syntaxhighlight lang="shell" line="1"> | |||
sudo apt update && \ | |||
sudo apt install composer | |||
</syntaxhighlight> | |||
'''Depending on the version of the OS the Composer's version could be relatively old.'''<noinclude> | |||
<div id='devStage'> | <div id='devStage'> | ||
{{devStage | {{devStage |
Revision as of 13:06, 7 January 2023
Update 2022
The instructions below may be deprecated! Because the instructions will change with every version of the installer… Instead, please visit the page https://getcomposer.org/download/ and follow the steps provided there!
If Composer is already installed on your system – i.e. /usr/local/bin/composer
– you can update it by the following command command :
sudo composer self-update
Upgrading to version 2.5.1 (stable channel).
Use 'composer self-update --rollback' to return to version 2.4.4
Install the latest version of Composer
sudo apt update
sudo apt install php-cli unzip
cd ~/tmp && \
curl -sS https://getcomposer.org/installer -o composer-setup.php && \
HASH=$(curl -sS https://composer.github.io/installer.sig) && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
composer -V
References
- Digital Ocean: How To Install Composer on Ubuntu 20.04 [Quick-start]
- Digital Ocean: How To Install and Use Composer on Ubuntu 20.04
Install Composer via Apt
sudo apt update && \
sudo apt install composer
Depending on the version of the OS the Composer's version could be relatively old.