安装作曲家


8

我是类Unix系统的新手,现在使用Ubuntu。尝试使用以下命令安装Composer时遇到麻烦:

(sudo) curl -sS https://getcomposer.org/installer | (sudo) php mv composer.phar /usr/local/bin/composer 

*尝试有无 sudo

在此之后,我将获得有关证书的详细信息,而没有其他任何信息:

Certinomis - Root CA
====================
-----BEGIN CERTIFICATE-----
MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBb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重要信息的一部分)

有什么建议吗?提前致谢

Answers:


14
sudo apt-get update
sudo apt-get install curl php5-cli git

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

这将在/ usr / local / bin下作为名为composer的系统级命令下载并安装Composer。输出应如下所示:

#!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

要测试安装,请运行:

composer

或在某些情况下

php composer

2
似乎是curl命令链中--install-dir中的虚假空间:对其进行了sudo php -- --install-dir=/usr/local/bin --filename=composer修复。
约翰·里德

4

从Ubuntu 15.10(明智地)开始,您可以从Ubuntu Apt软件包存储库安装Composer:

apt-get install composer

在Ubuntu 15.10和16.04中,此软件包包含Composer的1.0版之前的beta版本,但请放心,它非常稳定(Composer 1.0于2016年4月发布,但在此之前被广泛使用)。


1
它没有composer self-update命令。知道为什么吗?
Mubashar Abbas

@MubasharAbbas它旨在由apt升级。如果self-update可用,它将覆盖apt下载的文件,从而在next上可能造成冲突apt upgrade
PeterM

0

在ubuntu中安装Composer的步骤

步骤-1:检查是否安装了curl。

如果是,请忽略此步骤,否则请先安装curl。

根据您的PHP版本安装curl

PHP 5

sudo apt-get install php5-curl
sudo service apache2 restart

PHP 5.6

sudo apt-get install php5.6-curl
sudo service apache2 restart

PHP 7.0

sudo apt-get install php7.0-curl
sudo service apache2 restart

步骤-2:使用以下命令安装Composer

sudo apt-get update
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

成功安装后,请在终端中运行以下命令,以确认是否成功安装了composer。

 composer

它将使结果如下所示。 在此处输入图片说明

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.