Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure composer under Linux

2025-05-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install and configure composer under Linux, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

Composer is a dependency management tool above PHP5.3. It allows you to declare the code base on which the project depends, and it will install them for you in your project.

The preface records the installation and use of composer

Environment: Ali CVM linux

Download composer.phar first to install

Curl-sS https://getcomposer.org/installer | php if you want to make composer executable in any directory, move the downloaded composer.phar to / usr/local/bin and name it composer

Mv composer.phar / usr/local/bin/composer configure composer to use domestic mirror library

Composer config-g repo.packagist composer https://packagist.phpcomposer.com there is a note here that Composer does not allow root users to execute, so the execution will report this error

Do not run Composer as root/super user! When See https://getcomposer.org/root for details encounters this situation, you only need to switch to other users to execute it. If you do not have enough permissions to perform some operations, you can add the users or user groups you are using to the sudo configuration before executing them.

Using root users to execute

Chmod Ubunw / etc/sudoersvi / etc/sudoers found the configuration line for root

Root ALL= (ALL) ALL adds one of the following four configurations to save and exit according to its own needs

/ / user user001 allows the use of the sudo command, and the execution requires the input password user001 ALL= (ALL) ALL// user user001 allows the use of the sudo command, and the execution does not require the input password user001 ALL= (ALL) NOPASSWD: ALL// grouping group001 allows the use of the sudo command And execution requires input password% group001 ALL= (ALL) ALL// grouping group001 allows use of sudo command, and execution does not require input password% group001 ALL= (ALL) NOPASSWD: ALL to switch to the configured user to execute the corresponding command

Su user001sudo mv composer.phar / usr/local/bin/composer switch mirror sources, and you can choose one of the following to execute.

Domestic cloud image

Composer config-g repo.packagist composer https://packagist.phpcomposer.com Ali Cloud Image

Composer config-g repo.packagist composer https://mirrors.aliyun.com/composer/ thank you for reading this article carefully. I hope the article "how to install and configure composer under Linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report