如何在 AWS EC2 中一步安装 collectd 且无任何失败命令

如何在 AWS EC2 中一步安装 collectd 且无任何失败命令

我想在 AWS EC2 中安装 collectd。我以 root 身份运行:

yum install collectd -y

输出:

# yum install collectd -y
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package collectd.x86_64 0:5.8.0-2.19.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
=========================================================================================================================
Package                   Arch                    Version                              Repository                  Size
=========================================================================================================================
Installing:
collectd                  x86_64                  5.8.0-2.19.amzn1                     amzn-main                  702 k

Transaction Summary
=========================================================================================================================
Install  1 Package

Total download size: 702 k
Installed size: 1.6 M
Downloading packages:
collectd-5.8.0-2.19.amzn1.x86_64.rpm                                                              | 702 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : collectd-5.8.0-2.19.amzn1.x86_64                                                                      1/1 
Error unpacking rpm package collectd-5.8.0-2.19.amzn1.x86_64
error: unpacking of archive failed on file /usr/sbin/collectdmon;5d71797f: cpio: open
  Verifying  : collectd-5.8.0-2.19.amzn1.x86_64                                                                      1/1 

Failed:
  collectd.x86_64 0:5.8.0-2.19.amzn1                                                                                     

Complete!

尝试了很多方法后,我得出结论,连续运行该命令 6 次即可成功安装它:

输出:

# yum install collectd -y
Failed to set locale, defaulting to C
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package collectd.x86_64 0:5.8.0-2.19.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================
 Package                   Arch                    Version                              Repository                  Size
=========================================================================================================================
Installing:
 collectd                  x86_64                  5.8.0-2.19.amzn1                     amzn-main                  702 k

Transaction Summary
=========================================================================================================================
Install  1 Package

Total download size: 702 k
Installed size: 1.6 M
Downloading packages:
collectd-5.8.0-2.19.amzn1.x86_64.rpm                                                              | 702 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : collectd-5.8.0-2.19.amzn1.x86_64                                                                      1/1 
  Verifying  : collectd-5.8.0-2.19.amzn1.x86_64                                                                      1/1 

Installed:
  collectd.x86_64 0:5.8.0-2.19.amzn1                                                                                     

Complete!

我连续在 3 个不同的 EC2 中运行,除了连续 6 次执行相同的命令外,我没有运行任何其他命令,因此它似乎是确定性的。我想知道是否缺少了某些东西,或者是否有正确的方法来正确安装 collectd 并运行一次命令。

EC2 详细信息:

NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"

我将不胜感激任何见解或指导,谢谢!

答案1

问题在于 yum repolist 已过时 (yum repolist)。yum update使用已安装的 collectd 运行以下yum install collectd -y命令,成功运行一次命令。

相关内容