19

Suppose I install debian,and my Internet network comes down. Install works OK,but at the time to setup the apt mirror from list give error because network Internet is down. I continue to install without mirror(apt/sources.list contain only cdrom entry) Internet work..how to setup the debian mirror after installation? I know how to edit sources.list with vi,but I want the menu with mirror list selection.

GAD3R
  • 66,769
elbarna
  • 12,695

4 Answers4

15

You just want some mirror or the closest/fastest mirror. If it's the latter, then you could just install netselect-apt and run it. I just ran to see which are the fastest form my geographical location and it said -

[$] sudo netselect-apt testing
........
........
    The fastest 10 servers seem to be:

        http://mirrors.ispros.com.bd/debian/
        http://ftp.sg.debian.org/debian/
        http://mirrors.apu.edu.my/debian/
        http://ftp.iinet.net.au/debian/debian/
        http://debian.mirror.cambrium.nl/debian/
        http://mirror.sax.uk.as61049.net/debian/
        http://ftp.uk.debian.org/debian/
        http://mirror.vorboss.net/debian/
        http://mirror.1000mbps.com/debian/
        http://ftp.antik.sk/debian/

    Of the hosts tested we choose the fastest valid for HTTP:
            http://mirrors.ispros.com.bd/debian/

    Writing sources.list.
    sources.list exists, moving to sources.list.1484862805
    Done.

[$] cat sources.list.1484862805

     1  # Debian packages for testing
     2  deb http://debian.ec.as6453.net/debian/ testing main contrib
     3  # Uncomment the deb-src line if you want 'apt-get source'
     4  # to work with most packages.
     5  # deb-src http://debian.ec.as6453.net/debian/ testing main contrib
     6  
     7  # Security updates for stable
     8  # deb http://security.debian.org/ stable/updates main contrib

Hope you find it useful.

shirish
  • 12,356
9

As an alternative to the Debian redirector, you could try http://deb.debian.org/

This is a CDN powered by Fastly and should be faster than the redirector.

how to setup the debian mirror after installation?

Use apt edit-sources (as root!) to open /etc/apt/sources.list in the (command line) text editor of choice; when the file is saved it will be checked for syntax errors.

suprjami
  • 604
4

My Python script apt-smart that finds mirrors automaticly within your country, benchmarks and ranks them by status and speed, finally changes sources.list if you want to.

  • apt-smart supports both Debian and Ubuntu.
  • apt-smart automaticly finds where you are so you can easily get the closest/fastest mirror.
  • apt-smart does real HTTP download from each mirror to get more accurate results ( bandwidth & status ) and supports HTTP proxy.
  • apt-smart is being maintained, whereas many similar solutions are too old to run or leave bugs unfix for a long time.

You can easily install apt-smart via pip, for detailed copy'n'paste install commands please see Project Readme.

A usage example that lets you list ranked mirrors within your country:

$ apt-smart -l

With -l, or --list-mirrors, you will get ( example output from Travis CI U.S. Ubuntu server ):

---------------------------------------------------------------------------------------------------------
| Rank | Mirror URL                            | Available? | Updating? | Last updated    | Bandwidth   |
---------------------------------------------------------------------------------------------------------
|    1 | http://mirrors.gigenet.com/ubuntua... | Yes        | No        | Up to date      | 1.73 MB/s   |
|    2 | http://mirror.genesisadaptive.com/... | Yes        | No        | Up to date      | 1.68 MB/s   |
|    3 | http://ubuntu.mirrors.tds.net/pub/... | Yes        | No        | Up to date      | 1.4 MB/s    |
|    4 | http://repos.forethought.net/ubuntu   | Yes        | No        | Up to date      | 1.35 MB/s   |
|    5 | http://repo.miserver.it.umich.edu/... | Yes        | No        | Up to date      | 937.62 KB/s |
...
|   75 | http://mirror.cc.vt.edu/pub2/ubuntu   | Yes        | No        | 1 day behind    | 659.67 KB/s |
|   76 | http://mirror.atlantic.net/ubuntu     | Yes        | No        | 2 days behind   | 351.26 KB/s |
|   77 | http://mirror.lstn.net/ubuntu         | Yes        | No        | 4 days behind   | 806.81 KB/s |
|   78 | http://mirrors.usinternet.com/ubun... | Yes        | No        | 4 weeks behind  | 514.31 KB/s |
|   79 | http://mirrors.arpnetworks.com/Ubuntu | Yes        | No        | 19 weeks behind | 418.94 KB/s |
|   80 | http://mirrors.ocf.berkeley.edu/ub... | Yes        | Yes       | Up to date      | 446.07 KB/s |
---------------------------------------------------------------------------------------------------------
Full URLs which are too long to be shown in above table:
1: http://mirrors.gigenet.com/ubuntuarchive
2: http://mirror.genesisadaptive.com/ubuntu
3: http://ubuntu.mirrors.tds.net/pub/ubuntu
5: http://repo.miserver.it.umich.edu/ubuntu
...
78: http://mirrors.usinternet.com/ubuntu/archive
80: http://mirrors.ocf.berkeley.edu/ubuntu

Martin X
  • 141
  • 1
3

One problem with netselect is that the fastest download can change over time and you need to run it periodically.

You could use the Debian Redirector which will always choose the best download - http://httpredir.debian.org/

Note that the Security Repository need to be the ordinary one and not through Redirector

  • I actually have httpredirector setup at my end, that works as well. Sometimes, rarely though even that conks out. – shirish Jan 19 '17 at 23:59
  • and now deb.debian.org has taken over from http://redir.debian.org so that's that. – shirish Aug 08 '18 at 12:42