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 composer on Linux system

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

Share

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

This article introduces the relevant knowledge of "how to install composer in Linux system". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Composer is a command-line tool created by Jordi Boggiano and Nils Aderman whose mission is to help you automatically install the development packages you depend on for your project.

Installation tutorial First download composer.phar

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

mv composer.phar /usr/local/bin/composer Configuration composer Use domestic mirror library

composer config -g repo.packagist composer https://packagist.phpcomposer. com Here is a point to note, Composer does not allow root user execution, so the execution will report this error

Do not run Composer as root/super user! See https://getcomposer.org/root for details In this case, just switch other users to execute. If you have insufficient permission to execute some operations, you can add the user or user group you are using to sudo configuration and then execute.

Executed using root

chmod u+w /etc/sudoers vi /etc/sudoers Find the root configuration line

root ALL=(ALL) ALL Add one of the following four configurations according to your own needs

//user user001 allows sudo and requires password user001 ALL=(ALL) ALL //user user001 allows sudo and does not require password user001 ALL=(ALL) NOPASSWD: ALL //grouping group001 sudo command allowed and requires password %group001 for execution ALL=(ALL) ALL //grouping group001 Sudo command is allowed without password %group001 ALL=(ALL) NOPASSWD: ALL Switch to configured user and execute corresponding command

su user001 sudo mv composer.phar /usr/local/bin/composer Switch image source, select one of the following to execute

Domestic cloud mirror

composer config -g repo.packagist composer https://packagist.phpcomposer. com Aliyun Mirror

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/In short, Composer is a new package management tool for PHP ecosystem. It actually consists of two parts: Composer and Packagist.

"Linux system how to install composer" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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