I'm not sure what you want, but:
- The parent repository is always http://archive.ubuntu.com/ubuntu - everything else is a mirror of this. The other primary mirrors all have a domain of the form
<cctld>.archive.ubuntu.com
, where the two character short code is the Country Code Top Level Domain. You can find additional mirrors with their status at Launchpad.
- If you're on an architecture other than
amd64
(e.e.g, arm64
, armhf
, ppc64el
, etc.), then the parent repository is http://ports.ubuntu.com/ubuntu-ports. Use ports.ubuntu.com/ubuntu-ports
instead of archive.ubuntu.com/ubuntu
in everything that follows.
- The distribution codename is part of the channel (the third term). You can use
lsb_release -sc
to find that out, and it's the first word of the release pretty name in lowercase (trusty
for Trusty Tahr, for example).
- There are five channels:
<codename>
, <codename>-security
, <codename>-updates
, <codename>-backports
and <codename>-proposed
. The first is necessary as it is the base, the second is highly recommended as it contains security fixes, the fourth only if you need some package backported from a newer release and the fifth only if a developer asks you to enable it for testing a possible fix.
- There are four repository sections:
main
, multiverse
, universe
and restricted
(What's the difference between multiverse, universe, restricted and main?)
So you can always create a safe sources.list
which contains just:
deb http://archive.ubuntu.com/ubuntu <codename> main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu <codename>-security main multiverse universe restricted
If you want a command to do this:
printf 'deb http://archive.ubuntu.com/ubuntu %s main multiverse universe restricted\n' "$(lsb_release -sc)"{,-security} > /etc/apt/sources.list
Or, lsb_release
isn't available, use /etc/os-release
from the base-files
package:
printf 'deb http://archive.ubuntu.com/ubuntu %s main multiverse universe restricted\n' "$(. /etc/os-release; printf "%s" "$UBUNTU_CODENAME")"{,-security} > /etc/apt/sources.list
In addition to the Launchpad list, the list provided by the Software Sources program is
from /usr/share/python-apt/templates/Ubuntu.mirrors
, which is from the python-apt-common
package. This package is only an indirect Suggests dependency of apt
, so it may not be installed by default on a server.