⭐️ Amazon Web Service/Amazon EC2

[Amazon EC2-Amazonlinux2] php composer / aws-sdk-php 설치 및 삭제

mini_world 2020. 11. 30. 10:33
목차 접기

 

이번 포스팅에서는
EC2 (OS:Amazon Linux2) 에 php sdk를 설치하고 삭제하는것까지 안내합니다 :)

Centos7 & Redhat 7 에서도 아래와 동일하게 설치/삭제 가능합니다.

 


 

1. composer / aws-sdk-php 설치

1-1) php composer 설치

​composer.phar 를 다운받습니다. 다운받은
이 파일은 별도로 설치할 필요가 없는 바이너리 실행 파일입니다.

[root@server /]# curl -s https://getcomposer.org/installer | php

All settings correct for using Composer
Downloading...
Composer (version 2.0.7) successfully installed to: //composer.phar
Use it: php composer.phar

​composer.phar를 명령어로 사용하기  위해 아래처럼 bin 폴더에 넣고 링크파일을 만들어주면,
composer 명령어 사용 가능합니다 :)

[root@server /]# mv composer.phar /usr/local/bin/composer
[root@server /]# ln -s /usr/local/bin/composer /usr/bin/composer

 

1-2) aws/aws-sdk-php 설치

composer는 PHP 소프트웨어와 필요 라이브러리의 의존성을 관리하기 위한 PHP 패키지 관리자입니다.
composer를 사용하면 간단하게 설치가 완료됩니다 :)

[root@server /]# composer require aws/aws-sdk-php

Using version ^2.8 for aws/aws-sdk-php
./composer.json has been created
Running composer update aws/aws-sdk-php
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
  - Locking aws/aws-sdk-php (2.8.31)
  - Locking guzzle/guzzle (v3.9.3)
  - Locking symfony/event-dispatcher (v2.8.52)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Downloading symfony/event-dispatcher (v2.8.52)
  - Downloading guzzle/guzzle (v3.9.3)
  - Downloading aws/aws-sdk-php (2.8.31)
  - Installing symfony/event-dispatcher (v2.8.52): Extracting archive
  - Installing guzzle/guzzle (v3.9.3): Extracting archive
  - Installing aws/aws-sdk-php (2.8.31): Extracting archive
7 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Generating autoload files

 

 

2. composer / aws-sdk-php 삭제

 

2-1)  aws/aws-sdk-php 삭제

설치와 마찬가지로 삭제도 매우 간편합니다.
composer remove 명령어로 php 패키지를 삭제합니다.

[root@server /]# composer remove aws/aws-sdk-php

./composer.json has been updated
Running composer update aws/aws-sdk-php
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 3 removals
  - Removing aws/aws-sdk-php (2.8.31)
  - Removing guzzle/guzzle (v3.9.3)
  - Removing symfony/event-dispatcher (v2.8.52)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 3 removals
  - Removing symfony/event-dispatcher (v2.8.52)
  - Removing guzzle/guzzle (v3.9.3)
  - Removing aws/aws-sdk-php (2.8.31)
Generating autoload files

 

2-2) Composer 파일 삭제

Composer는 설치 시 간편하게 바이너리 설치 파일을 다운받았습니다.
삭제시에도 링크파일을 삭제하고, 바이너리 파일만 삭제 해주시면 됩니다.
단, 컴포저 파일 삭제 후 필요에 따라 캐시 파일을 삭제합니다. (find / -name composer* 명령어로 확인)

[root@server /]# rm /usr/bin/composer

rm: remove symbolic link ‘/usr/bin/composer’? y
[root@server /]# rm /usr/local/bin/composer

rm: remove regular file ‘/usr/local/bin/composer’? y
728x90