如何在使用 cloud-init 安装包之前启用 epel-release?

如何在使用 cloud-init 安装包之前启用 epel-release?

我正在尝试通过 在 CentOS 8 上安装一些软件包cloud-init,如下所示:

package_upgrade: true

packages:
  - firewalld
  - htop

其中一个需要epel-release先安装 repo:

No match for argument: htop
2019-10-21 15:50:35,444 - util.py[WARNING]: Failed to install packages: ['firewalld', 'htop']

我怎样才能epel-release先安装然后再安装包?

答案1

将其添加到您的云初始化脚本中:

yum_repos:
    epel-release:
        baseurl: http://download.fedoraproject.org/pub/epel/7/$basearch
        enabled: true
        failovermethod: priority
        gpgcheck: true
        gpgkey: http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
        name: Extra Packages for Enterprise Linux 7 - Release

相关内容