-2

I know how to install a specific version of a package. Now I want to upgrade all packages of my system with:

sudo apt upgrade

But for a specific package, I do not want it to upgrade to the latest version, but to a specific one. E. g., currently installed version is 1. Latest available via apt is 3. I want to upgrade to 2. Is it possible with apt?

1 Answers1

0

With nobody's helpful comment, pointing to apt-pinning, I was able to come up with the following solution:

You can pin a package to a specific version by creating a preference file for it (e. g. /etc/apt/preferences.d/my-package) with the following content:

Package: my-package
Pin: version 2
Pin-Priority: 1000

This will tell apt to not upgrade package my-package to a greater version than 2.