apt don't upgrade specific package

Sometimes it can be handy not to upgrade certain packages during an apt-get upgrade, e.g. in a MySQL replication setup where MySQL requires special attention. To prevent a package from being upgraded, use the command

apt-mark hold packagename

In case of MySQL the full command could look like this:

sudo apt-mark hold mysql-client-core-5.5 mysql-client-5.5 mysql-server-core-5.5 mysql-server-5.5 mysql-client mysql-server mysql-common

Simulate with

apt-get -s upgrade

what will happen during the update and add other packages as needed to the hold list. To remove a list from the hold use

sudo apt-mark unhold packagename

You can also use the apt-mark hold command to prevent a package from being installed.

apt don't upgrade specific package
Share this