2016-09-27 23 views
0

我试图通过“用户数据”功能(使用cloud-init)在AWS中启动基于Amazon Linux的EC2实例后安装p7zip软件包:通过“用户数据”(Amazon Linux)启用EPE与cloud-init

#cloud-config 
repo_update: true 
repo_upgrade: all 

packages: 
- p7zip 

但是,由于p7zip不可用正常回购,并需要EPEL启用,它似乎并没有被正确读取软件包。

我的问题是:使用cloud-init,在初始化EC2实例时如何在获取软件包之前启用EPEL?

回答

1
#cloud-config 
# vim: syntax=yaml 
# 
# Add yum repository configuration to the system 
# 
# The following example adds the file /etc/yum.repos.d/epel_testing.repo 
# which can then subsequently be used by yum for later operations. 
yum_repos: 
    # The name of the repository 
    epel-testing: 
     # Any repository configuration options 
     # See: man yum.conf 
     # 
     # This one is required! 
     baseurl: http://download.fedoraproject.org/pub/epel/testing/5/$basearch 
     enabled: false 
     failovermethod: priority 
     gpgcheck: true 
     gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL 
     name: Extra Packages for Enterprise Linux 5 - Testing 
0

对于较新版本的亚马逊的Linux,你需要添加以下到云的配置文件:

yum_repos: 
    epel_custom: 
     name: Extra Packages for Enterprise Linux 6 - $basearch 
     baseurl: http://download.fedoraproject.org/pub/epel/6/$basearch 
     mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch 
     failovermethod: priority 
     enabled: true 
     gpgcheck: true 
     gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 

Here是可以在使用的工作云-config文件的例子引导为userdata

相关问题