![Ubuntu 22.04에 Composer를 설치하는 방법 [빠른 시작]](/tutorial-cover/post/Ubuntu 22 04에 Composer를 설치하는 방법 [빠른 시작].png)
Ubuntu 22.04에 Composer를 설치하는 방법 [빠른 시작]
2022-05-31 last update
6 minutes reading Quickstart PHP Interactive Ubuntu Ubuntu 22.04소개
이 빠른 시작 안내서에는 Ubuntu 22.04 서버에 설치됩니다Composer.
이 강좌의 더 자세한 버전과 각 단계에 대한 자세한 설명은 How To Install and Use Composer on Ubuntu 22.04 을 참조하십시오.
선결 조건
이 안내서를 따르려면 Ubuntu 22.04 서버에
sudo
사용자로 액세스해야 합니다.브라우저에서 터미널 설치 Composer를 사용하려면 아래
Launch an Interactive Terminal!
버튼을 클릭합니다.단계 1 - 종속성 설치
우선 패키지 관리자 캐시를 업데이트하고 설치하는 데 필요한 의존 항목
php-cli
을 포함합니다.- sudo apt update
- sudo apt install php-cli unzip
2단계 - Composer 다운로드 및 설치
홈 디렉토리에 있는지 확인한 다음
curl
검색 Composer installer 을 사용합니다.- cd ~
- curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
다음은 다운로드한 설치 프로그램이 Composer Public Keys / Signatures 페이지에서 찾은 최신 설치 프로그램의 SHA-384 해시와 일치하는지 확인합니다.curl
를 사용하여 최신 서명을 가져와 셸 변수에 저장합니다.- HASH=`curl -sS https://composer.github.io/installer.sig`
다음 PHP 코드를 실행하여 설치 스크립트가 안전하게 실행되는지 확인합니다.- php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
다음 출력이 표시됩니다.출력
Installer verified
참고: Installer corrupt
로 출력된 경우 검증된 설치 프로그램이 있을 때까지 다운로드 및 검증 프로세스를 반복해야 합니다.다음 명령은 Composer를 다운로드하여
composer
라는 시스템 범위 명령으로 설치합니다/usr/local/bin
.- sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
다음과 같은 출력이 표시됩니다.OutputAll settings correct for using Composer
Downloading...
Composer (version 2.3.5) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
설치를 테스트하려면 다음을 실행하십시오.- composer
Output ______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 2.3.5 2022-04-13 16:43:00
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
--no-scripts Skips the execution of all scripts defined in composer.json file.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
--no-cache Prevent use of the cache
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
...
그러면 Composer가 시스템에 성공적으로 설치되었는지 확인하고 시스템 내에서 사용할 수 있습니다.관련 강좌
다음은 이 강좌와 관련된 더 자세한 안내서의 링크입니다.