本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
安装适用于 Ubuntu Server 的 CodeDeploy 代理
注意
我们建议使用 Amazon Systems Manager 安装 CodeDeploy 代理,以便能够配置代理的计划更新。有关更多信息,请参阅使用 Amazon Systems Manager 安装 CodeDeploy 代理。
在 Ubuntu Server 上安装 CodeDeploy 代理
-
登录到实例。
-
依次输入以下命令:
sudo apt update
sudo apt install ruby-full
sudo apt install wget
-
输入以下 命令:
cd
/home/ubuntu
/home/ubuntu
表示 Ubuntu Server 实例的默认用户名。如果您的实例是使用某个自定义 AMI 创建的,该 AMI 所有者可能已指定不同的默认用户名。 -
输入以下 命令:
对于中国(北京)区域:
-
wget https://aws-codedeploy-cn-north-1.s3.cn-north-1.amazonaws.com/latest/install
对于中国(宁夏)区域:
-
wget https://aws-codedeploy-cn-northwest-1.s3.cn-northwest-1.amazonaws.com/latest/install
例如:
https://aws-codedeploy-us-east-2.s3.us-east-2.amazonaws.com/latest/install
有关存储桶名称和区域标识符的列表,请参阅各区域的资源工具包存储桶名称。
-
-
输入以下 命令:
chmod +x ./install
-
请执行以下操作之一:
-
要在除 20.04 之外 的任何受支持版本的 Ubuntu Server 上安装最新版本的 CodeDeploy 代理,请执行以下操作:
sudo ./install auto
-
要在 Ubuntu Server 20.04 上安装最新版本的 CodeDeploy 代理,请执行以下操作:
注意
将输出写入临时日志文件是一种变通方法,当我们在 Ubuntu Server 20.04 上解决
install
脚本的一个已知错误时,应该使用这种方法。sudo ./install auto > /tmp/logfile
-
要在除 20.04 之外 的任何受支持版本的 Ubuntu Server 上安装特定版本的 CodeDeploy 代理,请执行以下操作:
-
列出您所在区域的可用版本:
aws s3 ls s3://aws-codedeploy-
region-identifier
/releases/ --regionregion-identifier
| grep '\.deb$' -
安装以下版本之一:
sudo ./install auto -v releases/codedeploy-agent-
###
.deb注意
支持的 CodeDeploy 代理的最低版本为 1.5.0。
-
-
要在 Ubuntu Server 20.04 上安装特定版本的 CodeDeploy 代理,请执行以下操作:
-
列出您所在区域的可用版本:
aws s3 ls s3://aws-codedeploy-
region-identifier
/releases/ --regionregion-identifier
| grep '\.deb$' -
安装以下版本之一:
sudo ./install auto -v releases/codedeploy-agent-
###
.deb > /tmp/logfile注意
将输出写入临时日志文件是一种变通方法,当我们在 Ubuntu Server 20.04 上解决
install
脚本的一个已知错误时,应该使用这种方法。注意
支持的 CodeDeploy 代理的最低版本为 1.5.0。
-
-
检查服务是否正在运行
-
输入以下 命令:
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