Apt-Pinning
Apt-Pinning is a method to set priorities on certain Debian/Ubuntu repos. This can be useful to make some experimental repos be excluded, but useful if you need a few packages from them.
Example: Lucid with some Maverick Packages
0. Run apt-get update; apt-get dist-upgrade to get completely up to date in pure lucid.
1. Setup maverick sources in your sources.list.d:
deb http://us.ubuntu.com/ubuntu/ maverick main restricted universe multiverse deb-src http://us.ubuntu.com/ubuntu/ maverick main restricted universe multiverse deb http://us.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse deb-src http://us.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse deb http://security.ubuntu.com/ubuntu maverick-security main restricted universe multiverse deb-src http://security.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
2. Run:
apt-get update
3. At this point if you did a dist-upgrade it would upgrade your box to maverick, which is not intended. Now you must pin your packages. Lets say you want wordpress but not everything else. Then put this in a file in /etc/apt/preferences.d/
Package: wordpress Pin: release a=maverick Pin-Priority: 800 Package: wordpress Pin: release a=maverick-security Pin-Priority: 800 Package: wordpress Pin: release a=maverick-updates Pin-Priority: 800 Package: * Pin: release a=maverick Pin-Priority: -1 Package: * Pin: release a=maverick-security Pin-Priority: -1 Package: * Pin: release a=maverick-updates Pin-Priority: -1
4. Run apt-cache policy wordpress to see what it wants to do with the wordpress package:
root@server:~# apt-cache policy wordpress wordpress: Installed: (none) Candidate: 3.0.1-1ubuntu1.1 Package pin: 3.0.1-1ubuntu1.1 Version table: 3.0.1-1ubuntu1.1 800 -1 http://mirrors.tummy.com/pub/ftp.ubuntulinux.org/ubuntu/ maverick-updates/universe Packages -1 http://security.ubuntu.com/ubuntu/ maverick-security/universe Packages 3.0.1-1ubuntu1 800 -1 http://mirrors.tummy.com/pub/ftp.ubuntulinux.org/ubuntu/ maverick/universe Packages 2.9.2-1ubuntu1.1 800 500 http://mirrors.tummy.com/pub/ftp.ubuntulinux.org/ubuntu/ lucid-updates/universe Packages 500 http://security.ubuntu.com/ubuntu/ lucid-security/universe Packages 2.9.2-1ubuntu1 800 500 http://mirrors.tummy.com/pub/ftp.ubuntulinux.org/ubuntu/ lucid/universe Packages
You can see it wants to install the new version from maverick.
5. Now run apt-cache policy bash to see what it wants to do with bash:
bash: Installed: 4.1-2ubuntu3 Candidate: 4.1-2ubuntu3 Version table: 4.1-2ubuntu4 0 -1 http://mirrors.tummy.com/pub/ftp.ubuntulinux.org/ubuntu/ maverick/main Packages *** 4.1-2ubuntu3 0 500 http://mirrors.tummy.com/pub/ftp.ubuntulinux.org/ubuntu/ lucid/main Packages 100 /var/lib/dpkg/status
You can see it doesn't want to upgrade bash
6. Run:
apt-get --dry-run dist-upgrade
It shouldn't try to upgrade anything
7. run
apt-get install wordpress
Should install wordpress from maverick