Results 1 to 6 of 6

Thread: apt multiple repositories with priority?

  1. #1
    Join Date
    Jul 2005
    Location
    Melbourne, Australia
    Beans
    40
    Distro
    Ubuntu Karmic Koala (testing)

    Question apt multiple repositories with priority?

    My ISP provides a mirror of ubuntu, which I can reconfigure my sources.list to use the ISP repository instead. Since this local ISP mirror is free (does not contribute to monthly download quota), I much prefer to use it.

    But, this repository is only available inside the ISP network and IP range. Thus, if I am not connected to the internet from my home ISP connection, then 'apt-get update' attempts fail to connect to the repository.

    Is it possible to have multiple repositories defined, with a priority assignment? Thus, if I am at home and apt can connect to my local ISP's repo mirror then it will use that, but if I am not at home and it cannot connect then it will fall-back to another repo?

    Example ...

    deb ftp://ftp.netspace.net.au/pub/ubuntu/ intrepid main restricted 10
    deb http://au.archive.ubuntu.com/ubuntu/ intrepid main restricted 20

    Where the 10|20 at the end of each line denotes the usage priority. Thus use the 10 priority first (my ISP mirror) and if that fails then use the 20 priority line.

    I search the forums and used google, but could find nothing. I did find references to apt priority for package versions, but this didn't seem teh same/appropriate to me.

    Thanks.

  2. #2
    Join Date
    Jul 2005
    Location
    Melbourne, Australia
    Beans
    40
    Distro
    Ubuntu Karmic Koala (testing)

    Re: apt multiple repositories with priority?

    Bump. Nothing available at all to achieve this? If not, perhaps I should brainstorm it?

  3. #3
    Join Date
    Sep 2006
    Beans
    3,165
    Distro
    Ubuntu Karmic Koala (testing)

    Re: apt multiple repositories with priority?


  4. #4
    Join Date
    Jul 2005
    Location
    Melbourne, Australia
    Beans
    40
    Distro
    Ubuntu Karmic Koala (testing)

    Re: apt multiple repositories with priority?

    Quote Originally Posted by binbash View Post

    Thanks, but all of those only deal with pinning/prioritising repo's on the basis of package versions, and which version you want to keep/ignore. They don't deal/assist with multiple repo's where those repo's have the exact same packages and versions, and which repo you want to prioritise for downloading upgrades.

  5. #5
    Join Date
    Jul 2008
    Location
    Netherlands
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: apt multiple repositories with priority?

    Quote Originally Posted by Mouth View Post
    Thanks, but all of those only deal with pinning/prioritising repo's on the basis of package versions
    I think the easiest solution for you is to use two different copies of /etc/apt/sources.list and use (copy) the correct one when needed.
    You can even make some fancy shellscript which periodically looks up your ip-address and then copies the correct sources.list to /etc/apt/

  6. #6
    Join Date
    Dec 2007
    Beans
    5

    Re: apt multiple repositories with priority?

    Please correct me if I'm wrong - but I believe you can have multiple repositories in your sources.list file, and then Ubuntu prioritizes them in a top down manner.

    For Example - I have a 100Mb uplink to my ISP, and a 10Mb uplink to everything else. My ISP is an ubuntu mirror, so I have it first in the list, and the default ubuntu repository second, like this:

    deb ftp://mirrors.xmission.com/ubuntu/ jaunty main restricted universe multiverse
    deb ftp://mirrors.xmission.com/ubuntu/ jaunty-updates main restricted universe multiverse
    deb ftp://mirrors.xmission.com/ubuntu/ jaunty-security main restricted universe multiverse

    deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
    deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse

    It seems to work for me

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •