安装适用于 Ubuntu Server 的 CodeDeploy 代理
注意
我们建议使用 AWS Systems Manager 安装 CodeDeploy 代理,以便能够配置代理的计划更新。有关更多信息,请参阅 使用 AWS Systems Manager 安装 CodeDeploy 代理。
在 Ubuntu Server 上安装 CodeDeploy 代理
-
登录到实例。
-
依次输入以下命令:
sudo apt updatesudo apt install ruby-fullsudo apt install wget -
输入以下命令:
cd/home/ubuntu/home/ubuntu表示 Ubuntu Server 实例的默认用户名。如果您的实例是使用某个自定义 AMI 创建的,该 AMI 所有者可能已指定不同的默认用户名。 -
输入以下命令:
wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/installbucket-name是包含您所在区域的 CodeDeploy 资源工具包文件的 Amazon S3 存储桶的名称,region-identifier是您所在区域的标识符。例如:
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注意
AWS 支持 CodeDeploy 代理的最新次要版本。目前,最新的次要版本是 1.7.x。
-
-
要在 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脚本的一个已知错误时,应该使用这种方法。注意
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-agentsystemctl status codedeploy-agent