Ubuntu | Debian |
---|---|
deb http://archive.ubuntu.com/ubuntu zesty main universe |
deb http://ftp.us.debian.org/debian unstable main non-free contrib |
This prevents accidental upgrades by setting the priority of packages from the target release to 990 and to 500 for all other packages.
In /etc/apt/apt.conf
or /etc/apt/apt.conf.d/<file>
:
Ubuntu | Debian |
---|---|
APT::Default-Release "yakkety"; |
APT::Default-Release "stable"; |
You have two options here: you can either set the priorities in the preferences file(s) or overwrite them on command line.
In /etc/apt/preferences
or /etc/apt/preferences.d/<file>
:
Package: vim*
Pin: release n=zesty
Pin-Priority: 1000
The release can be specified with a distribution codename (n=zesty
or n=stretch
) or archive name (a=testing
).
Overwriting priorities:
# apt install vim/zesty
# apt -t zesty install vim
The first will not attempt to upgrade any packages on your system, so if specific dependencies are not met, the install will fail. The second method will attempt to install/upgrade any dependencies.
From apt_preferences(5):
APT will not question the preferences, so wrong settings can lead to uninstallable packages or wrong decisions while upgrading packages. Even more problems will arise if multiple distribution releases are mixed without a good understanding of the following paragraphs. Packages included in a specific release aren't tested in (and therefore don't always work as expected in) older or newer releases, or together with other packages from different releases. You have been warned.
Sources/more info: apt.conf(5) apt_preferences(5)