2016-09-27 25 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

相關問題