【问题标题】:yum update from wrong repository iyum 从错误的存储库更新我
【发布时间】:2013-11-19 11:06:09
【问题描述】:

我在 AWS 中运行 AWS Linux AMI,它似乎是 RHEL 并使用 yum (kernel 3.4.62-53.42.amzn1.x86_64) 。 amazon repo 包括过期的 nginx 1.4.2,所以我删除了它并使用 nginx 网站上给出的 repo 重新安装。我是这样做的:

sudo yum remove nginx*
sudo yum --disablerepo="*" --enablerepo="nginx" install nginx

请注意,yum 优先级已禁用。我尝试在 repo 文件中设置 priority=,但在阅读后决定禁用优先级是有意义的。

/etc/yum.repos.d 文件: amzn-main.repo 包含:

[amzn-main]
name=amzn-main-Base
mirrorlist=http://repo.us-east-1.amazonaws.com/$releasever/main/mirror.list
mirror_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=1
retries=5
timeout=10
report_instanceid=yes

[amzn-main-debuginfo]
name=amzn-main-debuginfo
mirrorlist=http://repo.us-east-1.amazonaws.com/$releasever/main/debuginfo/mirror.list
mirror_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=0
retries=5
timeout=10
report_instanceid=yes

nginx.repo 包含:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/6/$basearch/
gpgcheck=0
enabled=1
priority=1

现在在安装 nginx 1.4.3 后进行更新,它会尝试从 amazon main repo 安装旧版本:

$ sudo yum update
Loaded plugins: update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.4.3-1.el6.ngx will be updated
---> Package nginx.x86_64 1:1.4.2-1.12.amzn1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

所以不知道为什么要选择旧版本。有没有办法将 yum 配置为仅在版本比当前安装的版本新时才更新?如果没有办法,有没有办法在我进行一般更新时跳过 nginx 包,然后使用如上所述的另一个命令更新 nginx,该命令禁用所有 repos 并仅使用 nginx repo,这里又是:

sudo yum --disablerepo="*" --enablerepo="nginx" install nginx

【问题讨论】:

  • 您知道yum 如何替换$releasever 变量吗?

标签: amazon-web-services nginx yum rhel


【解决方案1】:

要忽略单个 yum 存储库中的任何特定软件包,可以在 /etc/yum.repos.d/${amazonreponame}.repo 配置文件中添加以下行:

 exclude=package_name*

例子:

[amzn-main]
name=amzn-main-Base
mirrorlist=http://repo.us-east-1.amazonaws.com/$releasever/main/mirror.list
mirror_expire=300
metadata_expire=300
priority=10
failovermethod=priority
fastestmirror_enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
enabled=1
retries=5
timeout=10
report_instanceid=yes
exclude=nginx*

exclude=* 选项也可以全局添加(即所有 repos)到 /etc/yum.conf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-24
    • 2018-06-05
    • 2016-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多