Ubuntu安装composer
更新:HHH   时间:2023-1-7


1.下载composer.phar

cd /home/anfang/Downloads
wget https://getcomposer.org/composer.phar

2.重命名composer.phar为composer

mv composer.phar composer

3.增加可执行权限

chmod +x composer

4.现在可以通过./composer 命令运行composer,但这只仅限于在当前目录运行。要想全局使用,composer ,要设置把它为全局变量。找到composer文件,把它移到/usl/local/bin 目录,这样就可以在全局使用composer 命令。

sudo mv composer /usr/local/bin 

国内源
composer config -g repo.packagist composer https://packagist.phpcomposer.com

具体地址:https://pkg.phpcomposer.com/

返回web开发教程...