Menu Close

How to prevent a package from being installed via APT

Considering donating if you found my post helpful 😊

Buy Me a Coffee QR Code

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

Issue

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.

Solution

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

Considering donating if you found my post helpful 😊

Buy Me a Coffee QR Code
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x