Preferred apt repository

Assuming your package repository is at repo.company.net, creating a file called e.g. /etc/apt/preferences.d/company-pinning containing the following will do the trick:

Package: *
Pin: origin repo.company.net
Pin-Priority: 600

The default priority is 500, so this will prefer the latest version from the intranet server.


You can do it by modifying your /etc/apt/preferences file; it's commonly referred to as "APT pinning". Here are some guides with details:

  • http://jaqque.sbih.org/kplug/apt-pinning.html
  • https://help.ubuntu.com/community/PinningHowto
  • http://www.argon.org/~roderick/apt-pinning.html

It should be enough to list the intranet source first, in sources.list. According to the manual:

It is important to list sources in order of preference, with the most preferred source listed first. Typically this will result in sorting by speed from fastest to slowest (CD-ROM followed by hosts on a local network, followed by distant Internet hosts, for example).

From a cursory look at the source, sources.list is traversed first, then the files in sources.list.d in an order that you can't control.