Question

If there are lots of sources in sourcelist, but I want apt-get to prefer source from local iso, rather than remote mirror, even when remote package is newer than local iso, I want apt-get to choose local iso, what I should do in order to make it works as I want?

This is my configuration of /etc/apt/source.list

deb file:///home/jack/dsk/ lucid main restricted deb http:// us.archive.ubuntu.com/ubuntu/ lucid main restricted deb-src http: //us.archive.ubuntu.com/ubuntu/ lucid main restricted

I run apt-get install ubuntu-desktop, it seems apt-get try to download package from remote mirror:( this is not the thing I want:( I am sure ubuntu-desktop package is in my local iso mirror :( so how to make apt-get choose to install the package from dsk/pool/main/u/ubuntu-meta/ubuntu-desktop_1.197_amd64.deb rather than from http: // us.archive.ubuntu.com/ubuntu/ lucid-updates/main libc6 2.11.1-0ubuntu7.10 ?

find dsk/ | grep ubuntu-desktop dsk/pool/main/u/ubuntu-meta/ubuntu-desktop_1.197_amd64.deb

After this operation, 2,191MB of additional disk space will be used. Get:1 http: // us.archive.ubuntu.com/ubuntu/ lucid-updates/main libc6 2.11.1-0ubuntu7.10 [4,389kB]

Was it helpful?

Solution

You are looking for "apt pinning", that is to set preferences between different versions of packages in different repos or branches (stable, testing...).

See apt preferences pin: origin local?

So based in that post you'd have to edit (or probably create because by default it does not exist) the file /etc/apt/preferences and put:

       Package: *
       Pin: origin ""
       Pin-Priority: 999
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top