Sometimes it’s useful to tell to our GNU/Linux system that we want to keep some packages on Hold or that we do not want to update them , for example you could have added a custom kernel and you don’t want that during an update the standard kernel takes its place, or perhaps you want to test some specific version.
These instructions are tested with distributions that use packages in the .deb format (such as Debian, Ubuntu and Mint), .rpm based distributions that use yum (Red Hat Enterprise, Centos, Fedora) and Gentoo.
Deb based distributions
There are different ways of holding back packages, I’ll show you with dpkg and aptitude, they do exactly the same thing so you can choose the one you like more.
Using dpkg
Put a package on hold
echo "package hold" | dpkg --set-selections |
Example
echo "tomboy hold" | dpkg --set-selections |
This command gives no output.
If you change your mind and you want to remove the hold on that package you can use
echo "package install" | dpkg --set-selections |
Example
echo "apache2 install" | dpkg --set-selections |
This command gives no output.
If you want to know the status of a package you can use the command:
dpkg --get-selections package |
Example
mint-desktop ~ # dpkg --get-selections tomboy tomboy install |
Using aptitude
With aptitude, you can hold a package using
#aptitude hold package_name |
Example
#aptitude hold tomboy |
and remove the hold with
aptitude unhold package_name |
Example
#aptitude unhold tomboy |
RPM based distributions
For the distribution that use yum you can put a package in “hold” editing the file /etc/yum.conf ad adding a line with the directive exclude:
exclude=package/s |
So for example you could use
exclude=tomboy,php*,kernel* |
To exclude the package tomboy and all php and kernel packages from being updated with the command yum update
.
Gentoo
Gentoo uses the file /etc/portage/package.keywords to configure when to use a particular version of a package. Simply list the package and add the specific version you want to keep on your system, so for example you could add the line:
=dev-lang/ruby-1.9.3-r2 |
To have this exact version of ruby on your system and don’t update it.
Popular Posts:
- None Found
THanks for this info. These is very usefull.
Thanks alot.