user2965798
user2965798

Reputation: 31

yum update from wrong repository i

I am running a AWS Linux AMI in AWS, it seems to be RHEL under the covers and uses yum (kernel 3.4.62-53.42.amzn1.x86_64) . The amazon repo includes nginx 1.4.2 which is out of date so I removed it and re-installed using the repo given at nginx website. I did this as such:

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

Note that yum priorities are disabled. I tried messing around with setting priority= in the repo files but decided disabling priorities made sense after reading up on it.

/etc/yum.repos.d files : amzn-main.repo contains:

[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 contains:

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

Now doing the update once nginx 1.4.3 is installed, it tries to install the old version from the 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

So not sure why its picking up the older version. Is there a way to configure yum to only update if the version is newer than currently installed? If there is no way, is there a way to skip nginx package when I do a general update and then update nginx using another command as described above that disables all repos and uses only nginx repo, here it is again:

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

Upvotes: 3

Views: 3409

Answers (1)

nex
nex

Reputation: 1

To ignore any specific package in a single yum repository, one may add the following line to their /etc/yum.repos.d/${amazonreponame}.repo configuration file:

 exclude=package_name*

Example:

[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*

The exclude=* option may also be added globally (i.e., all repos) to /etc/yum.conf

Upvotes: 0

Related Questions