3

On EC2 / Amazon Linux AMI (Centos based), I created /etc/yum.repos.d/nginx.repo:

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

Then I successfully installed nginx 1.4.2:

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

Now, when I run sudo yum update, I get:

---> Package nginx.x86_64 0:1.4.2-1.el6.ngx will be updated
---> Package nginx.x86_64 1:1.2.9-1.11.amzn1 will be an update

NO!

How do I permanently block the update? (which is actually a downgrade)

feklee
  • 505
  • 5
  • 19
  • Stop using Amazon Linux. – Michael Hampton Aug 19 '13 at 23:31
  • @MichaelHampton As Stefan Lasiewski points out and as I've read [elsewhere](http://yum.baseurl.org/wiki/ConflictingRepos#Disable:Onewrongisonetomany), in this case *nginx* got it wrong. By the way, in general, I am very happy with Amazon's Linux AMI, which I configured for a client years ago (Apache, PHP, MySQL, Shell). Now, I set up nginx on my own EC2 instance, for proxying to Node.js projects (incl. WebSockets). – feklee Aug 20 '13 at 09:51
  • 2
    Actually it's Amazon that screwed this up, by assigning an Epoch to their nginx package. – Michael Hampton Aug 20 '13 at 13:38
  • @MichaelHampton Thanks for pointing that out. According to `yum info nginx` (repository `amzn-updates`), the `Epoch` tag is set to a value of 1. The package from repository `nginx` has no epoch tag. – feklee Aug 20 '13 at 19:18

3 Answers3

7

Maintainers of third party repositories should name their packages in a way that doesn't interfere with the main repository, otherwise conflicts like this will happen. Conflicts like the above are unprofessional and a sign of poor quality.

Some workarounds are:

YUM priorities

You can use Yum Priorities configure each repo to use a certain priority by assigning priority=N to the repositories listed in the .repo file. Some Yum developers have criticized Yum Priorities. Read the "Cautionary Note" at the bottom.

Excluding packages

You can also exclude packages from certain repositories. So, add something like this to your main repo. Substitute your package names.

[main]
exclude=php* kernel* 
Stefan Lasiewski
  • 23,667
  • 41
  • 132
  • 186
  • 1
    Appending `priority=1` to `/etc/yum.repos.d/nginx.repo` did the trick: `No Packages marked for Update` – feklee Aug 20 '13 at 09:44
  • Priorities is the only real option you have, since the problem is that Amazon put an Epoch on their nginx packages for no apparent (and probably no good) reason. – Michael Hampton Aug 20 '13 at 13:39
  • yum-versionlock might be a solution too, but if you don't want to upgrade package from same repo too. – GioMac Aug 20 '13 at 15:29
1

You can use yum update-minimal

update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system

David Makogon
  • 2,768
  • 1
  • 20
  • 29
Mansur Ul Hasan
  • 262
  • 3
  • 9
0

You can use the following command to specify packages not to be updated:

yum --exclude=nginx* update

larrylampco
  • 103
  • 7