How To: Update Your Ubuntu GNU/Linux sources.list the Geeky Way
This tip is especially useful around April/October when the new Ubuntu releases are freed into the wild and the main servers are very busy.
I know what you're saying: This can easily be done from the Ubuntu Software Center via the edit > sources menu. Yes, this is true, but now that's not a very geeky (or terminal-fast) thing to do, now is it? Besides, I like it better when I can initiate the sources update myself with sudo apt-get update, vs. having the software centre do it on exit.
To change your sources.list package server setting from the command line.
1.) Open the Terminal. Simply hit CTRL+ALT+T.
2.) Run this command to update your sources.list file:
sudo sed -i.backup 's/us.archive.ubuntu.com/mirror.anl.gov/g' /etc/apt/sources.list
3.) Run this command to see if your change took effect (you should see mirror.pnl.gov instead of us.archive.ubuntu.com on update).
sudo apt-get update
a.) Edits your sources.list file in place (makes a backup of your current sources.list as /etc/apt/sources.list.backup). Keep in mind if you run the command twice - the backup will be overwritten.
b.) Assumes your Ubuntu was installed in the USA(can probably swap the us for your country code) - hence the us.archive.ubuntu.com original setting.
c.) Assumes you want to replace your current package source with mirror.pnl.gov (that one is fast for me here in Seattle, WA). See your list of options for package servers by running this command:
Alternatively, checkout https://launchpad.net/ubuntu/+
archivemirrors for list with speeds and other information.
Feel free to leave your suggestions for the better way below. Thanks!
See these links for more information: