Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I enable non-free packages on Debian? I want to install Sun's Java JDK but it's not available to me.

share|improve this question
up vote 29 down vote accepted

Open up /etc/apt/sources.list, and you should see lines like the following (URLs will likely vary):

deb stable main contrib

Simply add non-free to the respective URLs you wish to use, i.e.:

 deb stable main contrib non-free

Running apt-get update will update your local repo with the package listing.

share|improve this answer

You can also restrict this a little bit if you only want some very specific packages from non-free (firmwares for your hardware for example).

To do so, keep your /etc/apt/sources.list as described by @Andrew M. Then, use Apt Pinning to disable by default all non-free packages for your current release:

Create a file named /etc/apt/preferences.d/non-free_policy containing the following directives:

Explanation: Disable packages from non-free tree by default
Package: *
Pin: release o=Debian,a=stable,l=Debian,c=non-free
Pin-Priority: -1

Now, create another file for the specific package you want to get from non-free.
Let's assume you want to add the Intel drivers for wireless cards for instance (package firmware-iwlwifi).
Create a file name /etc/apt/preferences.d/firmware-iwlwifi_nonfree with these lines:

Explanation: Enable package firmware-iwlwifi from non-free tree
Package: firmware-iwlwifi
Pin: release o=Debian,a=stable,l=Debian,c=non-free
Pin-Priority: 600

This configuration avoids bloating your package with these annoying non-free packages ;)

share|improve this answer
More information about apt pinning here: – jopasserat Mar 8 '14 at 14:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.