3

This is what my sources.list looks like currently:

deb http://ftp.us.debian.org/debian/ jessie main
deb-src http://ftp.us.debian.org/debian/ jessie main

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib

# jessie-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ jessie-updates main contrib
deb-src http://ftp.us.debian.org/debian/ jessie-updates main contrib

As you can see, the repositories are mirrors from the US region. How do I change it to another repository region automatically, without having to change the sources.list manually?

I only know how to delete the old repo and change it manually to the other region repo, like AU repositories or other repositories.

I know that we can change the repo region Debian uses by following this format:

http://ftp.[Region].debian.org/debian/

But how about repositories which do not follow the default format such as: kartolo.sby.datautama.net.id, which is a repo from Indonesia? How can I change this to one from this list here?

5

To clarify, you are asking if it is possible to change what mirror you are using without editing your sources.list? As far as I know, you will need to be able to edit your sources.list to use a different mirror than the one your sources.list is currently configured to use.

However you can use netselect-apt to discover the fastest mirror for your region and use that one to fetch updates from.

1. netselect-apt

This post appears to be related to your question. It references using netselect-apt to automatically detect the best repository mirror to use for your sources.list. You can also reference the netselect-apt manpage to learn more about using netselect-apt. You can run this command as root(sudo):

netselect-apt -c indonesia -t 15 -a amd64 -n jessie

to select the fastest repository to use. The -c option checks repositories in the Indonesia region, -t checks the top 15 sites, -a is to the CPU architecture your machine uses (in this case 64-bit), and -n is for what repository you want to pull from (stable/testing/release/etc). You can run this command to automatically update your sources.list with the fastest mirror. Remember to use the correct parameters for your system.

Alternatively you can just run netselect-apt and you should get similar results.

There is also another tool to find fast mirrors and automatically edit your sources.list. apt-spy works just like netselect-apt.

2. Manually Discovering Better Mirrors

I have found this site that can help you find better mirrors to use based on your region. Enter in your criteria and then edit your sources.list with the results you get.

Conclusion

I do not know of a way to use an alternate mirror with apt without editing your sources.list. I know other package managers have dynamic mirror list systems built into them but none exist for apt. If someone could correct me on this I would greatly appreciate it. However there are tools you can use to discover better mirrors for apt to use based off of your region and bandwidth.

netselect-apt and apt-spy are command-line tools that can help you do what you are asking. Remember you need root or sudo privileges to run these commands, just like you do when running an update or completing some kind of package management task. Best of Luck!

Not the answer you're looking for? Browse other questions tagged or ask your own question.