Ubuntu安装composer

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/

转载于:https://blog.51cto.com/11140372/2335932

你可能感兴趣的:(Ubuntu安装composer)