17

On CentOS exists the yum versionlock option, where you can lock a package to a specific version, so it is never upgraded past that.

I would like that

puppet-server-2.7.19-1
puppet-2.7.19-1

stays on 2.7, and never upgraded to 3.0. Puppet Labs have released 3.0 and put it into the stable repo, so 2.7 will get upgraded to 3.0, which is not backwards compatible.

Does Ubuntu have something similar to yum versionlock?

Sandra
  • 9,973
  • 37
  • 104
  • 160

2 Answers2

25

You can create a file in /etc/apt/preferences and pin packages' version.

The format for the file would be somewhat like this:

Package: puppet-server
Pin: version 2.7*
Pin-Priority: 550

See also:

jokerdino
  • 391
  • 3
  • 12
  • Note if there is no star at the end of the pin version, it will go for latest! . Or you have to find the exact ubuntu numenclature, something like 2.7.1-00. – NicoKowe Aug 31 '22 at 13:51
7

You can try this:

aptitude hold puppet-server puppet
echo "puppet-server hold" | dpkg --set-selections
echo "puppet hold" | dpkg --set-selections
ThorstenS
  • 3,084
  • 18
  • 21
  • 2
    `hold` will keep the package at the current version, and not let it upgrade any further. I would like it to upgrade to any 2.7.x but not 3.x.x – Sandra Oct 05 '12 at 11:33