Saturday, September 9, 2017

linux - How can I run Debian stable but install some packages from testing?



Say you're running a server and you don't want to upgrade to Testing (Squeeze) from Stable (Lenny) to just install a required package or two.



What's the best way of installing only certain packages from Testing?


Answer



apt_preferences



Define the default level that the system should 'safe-upgrade' to in the /etc/apt/preferences file:
man apt_preferences




There's a lot you can do with apt_preferences but for the sake of simplicity...



I needed to install a single package (autoMysqlBackup) that was only available in Testing. The solution was to add the following to /etc/apt/preferences:



Explanation: Uninstall or do not install any Debian-originated
Explanation: package versions other than those in the stable distro
Package: *
Pin: release a=stable
Pin-Priority: 900


Package: *
Pin: release o=Debian
Pin-Priority: -10


With multiple repositories added to /etc/apt/sources.list aptitude will now only upgrade to your specified release even though the later release repos are listed (in this case 'stable').



deb http://mirror.aarnet.edu.au/debian/ lenny main
deb-src http://mirror.aarnet.edu.au/debian/ lenny main
deb http://mirror.aarnet.edu.au/debian/ squeeze main

deb-src http://mirror.aarnet.edu.au/debian/ squeeze main


So to install that package, all you have to do is:



$ aptitude install -t testing packageName 

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...