

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 명령줄을 사용하여 CodeDeploy 에이전트 설치
<a name="codedeploy-agent-operations-install-cli"></a>

**참고**  
에이전트의 예약된 업데이트를 구성할 수 AWS Systems Manager 있도록를 사용하여 CodeDeploy 에이전트를 설치하는 것이 좋습니다. 자세한 내용은 [를 사용하여 CodeDeploy 에이전트 설치 AWS Systems Manager](codedeploy-agent-operations-install-ssm.md) 단원을 참조하십시오.

명령줄을 사용하여 CodeDeploy 에이전트를 설치하고 실행하는 방법에 대해서는 다음 주제를 참조하세요.

**Topics**
+ [Amazon Linux 또는 RHEL용 CodeDeploy 에이전트 설치](codedeploy-agent-operations-install-linux.md)
+ [Ubuntu Server용 CodeDeploy 에이전트 설치](codedeploy-agent-operations-install-ubuntu.md)
+ [Windows Server용 CodeDeploy 에이전트 설치](codedeploy-agent-operations-install-windows.md)

# Amazon Linux 또는 RHEL용 CodeDeploy 에이전트 설치
<a name="codedeploy-agent-operations-install-linux"></a>

인스턴스에 로그인하여 다음 명령을 한 번에 하나씩 실행합니다. `yum`을 사용하여 패키지를 설치할 때 첫 번째 명령인 `sudo yum update`를 먼저 실행하는 것이 가장 좋습니다. 그러나 모든 패키지를 업데이트하지 않으려면 이 명령을 건너뛸 수 있습니다.

```
sudo yum update
```

```
sudo yum install ruby
```

```
sudo yum install wget
```

(선택 사항) 이전 에이전트 캐싱 정보의 AMI를 정리하려면 다음 스크립트를 실행합니다.

```
#!/bin/bash
CODEDEPLOY_BIN="/opt/codedeploy-agent/bin/codedeploy-agent"
$CODEDEPLOY_BIN stop
yum erase codedeploy-agent -y
```

홈 디렉터리로 이동합니다.

```
cd /home/ec2-user
```

**참고**  
앞의 명령에서 `/home/ec2-user`는 Amazon Linux 또는 RHEL Amazon EC2 인스턴스의 기본 사용자 이름을 나타냅니다. 사용자 지정 AMI를 사용하여 인스턴스를 만든 경우 AMI 소유자가 다른 기본 사용자 이름을 지정했을 수 있습니다.

CodeDeploy 에이전트 설치 관리자를 다운로드합니다.

```
wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/install
```

*bucket-name*은 해당 리전의 CodeDeploy 리소스 키트 파일이 포함되어 있는 Amazon S3 버킷의 이름이며, *region-identifier*는 리전의 식별자입니다.

예제:

`https://aws-codedeploy-us-east-2.s3.us-east-2.amazonaws.com/latest/install`

버킷 이름 및 리전 식별자 목록은 [리전별 리소스 키트 버킷 이름](resource-kit.md#resource-kit-bucket-names) 단원을 참조하세요.

`install` 파일에 대한 실행 권한을 설정합니다.

```
chmod +x ./install
```

최신 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.
+ 

  ```
  sudo ./install auto
  ```

특정 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.
+ 해당 리전에서 사용 가능한 버전을 나열합니다.

  ```
  aws s3 ls s3://aws-codedeploy-region-identifier/releases/ --region region-identifier | grep '\.rpm$'
  ```
+ 다음 버전 중 하나를 설치합니다.

  ```
  sudo ./install auto -v releases/codedeploy-agent-version.noarch.rpm
  ```
**참고**  
AWS 는 CodeDeploy 에이전트의 최신 마이너 버전을 지원합니다. 현재 최신 마이너 버전은 1.7.x입니다.

서비스가 실행 중인지 확인하려면 다음 명령을 실행합니다.

```
systemctl status codedeploy-agent
```

CodeDeploy 에이전트가 설치되어 실행 중이면 "`The AWS CodeDeploy agent is running`"와 같은 메시지가 표시되어야 합니다.

"`error: No AWS CodeDeploy agent running`"와 같은 메시지가 표시되면 서비스를 시작하고 다음 두 명령을 한 번에 하나씩 실행합니다.

```
systemctl start codedeploy-agent
```

```
systemctl status codedeploy-agent
```

# Ubuntu Server용 CodeDeploy 에이전트 설치
<a name="codedeploy-agent-operations-install-ubuntu"></a>

**참고**  
에이전트의 예약된 업데이트를 구성할 수 AWS Systems Manager 있도록를 사용하여 CodeDeploy 에이전트를 설치하는 것이 좋습니다. 자세한 내용은 [를 사용하여 CodeDeploy 에이전트 설치 AWS Systems Manager](codedeploy-agent-operations-install-ssm.md) 단원을 참조하십시오.

**Ubuntu Server에 CodeDeploy 에이전트를 설치하려면**

1. 인스턴스에 로그인합니다.

1. 다음 명령을 차례로 입력합니다.

   ```
   sudo apt update
   ```

   ```
   sudo apt install ruby-full
   ```

   ```
   sudo apt install wget
   ```

1. 다음 명령을 입력합니다.

   ```
   cd /home/ubuntu
   ```

   */home/Ubuntu*는 Ubuntu Server 인스턴스의 기본 사용자 이름을 나타냅니다. 사용자 지정 AMI를 사용하여 인스턴스를 만든 경우 AMI 소유자가 다른 기본 사용자 이름을 지정했을 수 있습니다.

1. 다음 명령을 입력합니다.

   ```
   wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/install
   ```

   *bucket-name*은 해당 리전의 CodeDeploy 리소스 키트 파일이 포함되어 있는 Amazon S3 버킷의 이름이며, *region-identifier*는 리전의 식별자입니다.

   예제:

   `https://aws-codedeploy-us-east-2.s3.us-east-2.amazonaws.com/latest/install`

   버킷 이름 및 리전 식별자 목록은 [리전별 리소스 키트 버킷 이름](resource-kit.md#resource-kit-bucket-names) 단원을 참조하세요.

1. 다음 명령을 입력합니다.

   ```
   chmod +x ./install
   ```

1. 다음 중 하나를 수행하세요.
   + 20.04를 *제외한* 지원되는 버전의 Ubuntu Serer에서 최신 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.

     ```
     sudo ./install auto
     ```
   + Ubuntu Server 20.04에서 최신 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.
**참고**  
출력을 임시 로그 파일에 쓰는 것은 Ubuntu Server 20.04에서 `install` 스크립트를 사용하여 알려진 버그를 해결하는 동안 사용해야 하는 해결 방법입니다.

     ```
     sudo ./install auto > /tmp/logfile
     ```
   + 20.04를 *제외한* 지원되는 버전의 Ubuntu Serer에서 특정 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.
     + 해당 리전에서 사용 가능한 버전을 나열합니다.

       ```
       aws s3 ls s3://aws-codedeploy-region-identifier/releases/ --region region-identifier | grep '\.deb$'
       ```
     + 다음 버전 중 하나를 설치합니다.

       ```
       sudo ./install auto -v releases/codedeploy-agent-###.deb
       ```
**참고**  
AWS 는 CodeDeploy 에이전트의 최신 마이너 버전을 지원합니다. 현재 최신 마이너 버전은 1.7.x입니다.
   + Ubuntu Server 20.04에서 특정 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.
     + 해당 리전에서 사용 가능한 버전을 나열합니다.

       ```
       aws s3 ls s3://aws-codedeploy-region-identifier/releases/ --region region-identifier | grep '\.deb$'
       ```
     + 다음 버전 중 하나를 설치합니다.

       ```
       sudo ./install auto -v releases/codedeploy-agent-###.deb > /tmp/logfile
       ```
**참고**  
출력을 임시 로그 파일에 쓰는 것은 Ubuntu Server 20.04에서 `install` 스크립트를 사용하여 알려진 버그를 해결하는 동안 사용해야 하는 해결 방법입니다.
**참고**  
AWS 는 CodeDeploy 에이전트의 최신 마이너 버전을 지원합니다. 현재 최신 마이너 버전은 1.7.x입니다.

**서비스가 실행 중인지 확인하려면**

1. 다음 명령을 입력합니다.

   ```
   systemctl status codedeploy-agent
   ```

   CodeDeploy 에이전트가 설치되어 실행 중이면 "`The AWS CodeDeploy agent is running`"와 같은 메시지가 표시되어야 합니다.

1. "`error: No AWS CodeDeploy agent running`"와 같은 메시지가 표시되면 서비스를 시작하고 다음 두 명령을 한 번에 하나씩 실행합니다.

   ```
   systemctl start codedeploy-agent
   ```

   ```
   systemctl status codedeploy-agent
   ```

# Windows Server용 CodeDeploy 에이전트 설치
<a name="codedeploy-agent-operations-install-windows"></a>

Windows Server 인스턴스에서 다음 방법 중 하나를 사용하여 CodeDeploy 에이전트를 다운로드하고 설치할 수 있습니다.
+ 사용 AWS Systems Manager (권장)
+ 일련의 Windows PowerShell 명령 실행
+ 직접 다운로드 링크 선택
+ Amazon S3 복사 명령을 실행합니다.

**참고**  
CodeDeploy 에이전트가 설치된 폴더는 `C:\Program Data\Amazon\CodeDeploy`입니다. 이 경로에 디렉터리 교차점 또는 심볼릭 링크가 없는 것을 확인해야 합니다.

**Topics**
+ [Systems Manager 사용](#codedeploy-agent-operations-install-system-manager)
+ [Windows PowerShell 사용](#codedeploy-agent-operations-install-windows-powershell)
+ [직접 링크 사용](#codedeploy-agent-operations-install-windows-direct-link)
+ [Amazon S3 복사 명령 사용](#codedeploy-agent-operations-install-windows-s3-copy)

## Systems Manager 사용
<a name="codedeploy-agent-operations-install-system-manager"></a>

CodeDeploy 에이전트를 설치하려면 [를 사용하여 CodeDeploy 에이전트 설치 AWS Systems Manager](codedeploy-agent-operations-install-ssm.md)의 지침을 따릅니다.

## Windows PowerShell 사용
<a name="codedeploy-agent-operations-install-windows-powershell"></a>

인스턴스에 로그인하여 Windows PowerShell에서 다음 명령을 실행합니다.

1.  인터넷에서 다운로드한 모든 스크립트와 구성 파일에 신뢰할 수 있는 게시자의 서명이 있어야 합니다. 실행 정책을 변경하라는 메시지가 나타나면 "**Y**"를 입력합니다.

   ```
    Set-ExecutionPolicy RemoteSigned
   ```

1.  를 로드합니다 AWS Tools for Windows PowerShell.

   ```
   Import-Module AWSPowerShell
   ```

1.  CodeDeploy 에이전트 설치 파일이 다운로드될 디렉터리를 생성합니다.

   ```
   New-Item -Path "c:\temp" -ItemType "directory" -Force
   ```

1. `Set-AWSCredential` 및 `Initialize-AWSDefaultConfiguration` 명령을 사용하여 AWS 자격 증명을 구성합니다. 자세한 내용은 *AWS Tools for PowerShell 사용 설명서*의 [AWS 자격 증명 사용](https://docs.aws.amazon.com/powershell/latest/userguide/specifying-your-aws-credentials.html)을 참조하세요.

1.  CodeDeploy 에이전트 설치 파일을 다운로드합니다.
**참고**  
AWS 는 CodeDeploy 에이전트의 최신 마이너 버전을 지원합니다. 현재 최신 마이너 버전은 1.7.x입니다.

   최신 버전의 CodeDeploy 에이전트를 설치하려면 다음을 수행합니다.
   + 

     ```
     powershell.exe -Command Read-S3Object -BucketName bucket-name -Key latest/codedeploy-agent.msi -File c:\temp\codedeploy-agent.msi
     ```

   특정 버전의 CodeDeploy 에이전트를 설치하려면
   + 

     ```
     powershell.exe -Command Read-S3Object -BucketName bucket-name -Key releases/codedeploy-agent-###.msi -File c:\temp\codedeploy-agent.msi
     ```

   *bucket-name*은 해당 리전의 CodeDeploy 리소스 키트 파일이 포함되어 있는 Amazon S3 버킷의 이름입니다. 예를 들어 미국 동부(오하이오) 리전의 경우 *bucket-name*을 `aws-codedeploy-us-east-2`로 바꿉니다. 버킷 이름 목록은 [리전별 리소스 키트 버킷 이름](resource-kit.md#resource-kit-bucket-names) 단원을 참조하세요.

1.  CodeDeploy 에이전트 설치 파일을 실행합니다.

   ```
   c:\temp\codedeploy-agent.msi /quiet /l c:\temp\host-agent-install-log.txt
   ```

서비스가 실행 중인지 확인하려면 다음 명령을 실행합니다.

```
powershell.exe -Command Get-Service -Name codedeployagent
```

 CodeDeploy 에이전트를 방금 설치했고 아직 시작하지 않은 경우 **Get-Service** 명령을 실행한 후 **상태**에 **Start...**이 표시되어야 합니다.

```
Status     Name                DisplayName
------     ----                -----------
Start...   codedeployagent    CodeDeploy Host Agent Service
```

CodeDeploy 에이전트가 이미 실행 중인 경우 **Get-Service** 명령을 실행한 후 **상태**에 **Running**이 표시되어야 합니다.

```
Status     Name                DisplayName
------     ----                -----------
Running    codedeployagent    CodeDeploy Host Agent Service
```

## 직접 링크 사용
<a name="codedeploy-agent-operations-install-windows-direct-link"></a>

Windows Server 인스턴스의 브라우저 보안 설정이 `https://s3.*.amazonaws.com` 등에 권한을 제공하는 경우, 리전의 직접 링크를 사용하여 CodeDeploy 에이전트를 다운로드한 후 설치 관리자를 수동으로 실행할 수 있습니다.

링크는 다음과 같습니다.

```
https://s3.region.amazonaws.com/aws-codedeploy-region/latest/codedeploy-agent.msi
```

여기서 *리전*은 애플리케이션을 배포하는 AWS 리전입니다.

예제:

```
https://s3.af-south-1.amazonaws.com/aws-codedeploy-af-south-1/latest/codedeploy-agent.msi
```

**중요**  
CodeDeploy 애플리케이션과 같은 리전에 있는 `.msi` 파일을 가져옵니다. 다른 리전을 선택하면 `.msi` 파일을 실행할 때 `codedeploy-agent-log` 파일에 `inconsistent region` 오류가 발생할 수 있습니다.

## Amazon S3 복사 명령 사용
<a name="codedeploy-agent-operations-install-windows-s3-copy"></a>

 AWS CLI 가 인스턴스에 설치된 경우 Amazon S3 [cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) 명령을 사용하여 CodeDeploy 에이전트를 다운로드한 다음 설치 관리자를 수동으로 실행할 수 있습니다. 자세한 내용은 [Microsoft Windows AWS Command Line Interface 에 설치를](https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html) 참조하세요.

Amazon S3 명령은 다음과 같습니다.

```
aws s3 cp s3://aws-codedeploy-region/latest/codedeploy-agent.msi codedeploy-agent.msi --region region
```

여기서 *리전*은 애플리케이션을 배포하는 AWS 리전입니다.

예제:

```
aws s3 cp s3://aws-codedeploy-af-south-1/latest/codedeploy-agent.msi codedeploy-agent.msi --region af-south-1
```