debian/ubuntu中如何阻止软件包的升级(转载)

If you want to update all the packages other than one package in your Ubuntu system follow this procedure There are three ways of holding back packages, with dpkg, aptitude or with dselect.

Using dpkg

Put a package on hold

sudo echo “package hold” | dpkg --set-selections

Example

sudo echo “apache2 hold” | dpkg --set-selections

Remove the hold

sudo echo “package install” | dpkg --set-selections

Example

sudo echo “apache2 install” | dpkg --set-selections

Knowing the status of your packages

sudo dpkg --set-selections

Using aptitude

With aptitude, you can hold a package using

sudo aptitude hold package_name

Example

sudo aptitude hold apache2

and remove the hold with

sudo aptitude unhold package_name

Example

sudo aptitude unhold apache2

Using dselect

With dselect, you just have to enter the [S]elect screen, find the package you wish to hold in its present state, and press the `=’ key (or `H’). The changes will go live immediately after you exit the [S]elect screen.

来源:How to prevent a package from being updated in Ubuntu

About 王永杰

路漫漫其修远兮,吾将上下而求索
This entry was posted in linux应用. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>