yum从错误的存储库更新i

时间:2013-11-07 17:04:51

标签: amazon-web-services nginx yum rhel

我在AWS中运行AWS Linux AMI,它似乎是RHEL,并使用yum(内核3.4.62-53.42.amzn1.x86_64)。亚马逊仓库包括已经过时的nginx 1.4.2,因此我将其删除并使用nginx网站上提供的仓库重新安装。我是这样做的:

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

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

/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主仓库安装旧版本:

$ 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

1 个答案:

答案 0 :(得分:0)

要忽略单个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=*选项也可以全局添加(即所有回购)到/etc/yum.conf