Menu Close

How to prevent a package from being installed via APT

Preventing a package from being installed can be very useful in some cases. This guide will show you on how to do that.


I just finished installing FFmpeg by compiling its source code. I install it by compiling the source code because I need extra flags for Fraunhofer FDK AAC and AV1. Since I have it installed, I don’t want any other packages attempt to install it again via APT repositories.


Edit or create file (if not exist) /etc/apt/preferences

$ sudo nano /etc/apt/preferences

Edit and put this template into the file. Replace ffmpeg wiht your preferred package name

Package: ffmpeg
Pin: release *
Pin-Priority: -1

Save the file by hitting CTRL + X and type y to confirm.

When you try to install the specified package, this will happen.

$ sudo apt install ffmpeg
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package ffmpeg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'ffmpeg' has no installation candidate

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x