HTML5, CSS3, jQuery, JSON, Responsive Design...

Changing Your Linux Repositories

Michael Brown   March 19 2009 02:47:57 AM
If you're on a broadband data cap and are using Linux in any way, you should check whether your ISP has any unmetered servers   If so, you may be able to save bandwidth (and, therefore, money!) by switching your Linux distribution to use your ISP's repositories rather than its default ones.

For example, the Internode (my own ISP) unmetered mirrors for Linux (they have some other ones for games etc) can be found at::

http://mirror.internode.on.net/pub/

How you point your Linux distribution to use them varies from distribution to distribution, and even between versions of the same distribution.


Changing the repositories for Ubuntu

In Ubuntu, the repository location is controlled by the file /etc/apt/sources.list.  This file is restricted to superuser access, so you will need to either change to the root account or use sudo, depending upon your Linus distribution.  In Ubuntu, open a Terminal window and type:

sudo gedit /etc/apt/sources.list

Gedit is the default text editor for Gnome.  You'll see that all the lines in the sources.list file point towards Ubuntu's own ubuntu.com servers, so that is where Ubuntu will get all of its updated packages. We need to comment out all those lines and replace them with ones that point to Internode's repositories.

Comment every line that is not already commented out with a hash symbol.  Then paste in the lines that point towards your preferred repository server.  These are the lines that will direct Ubuntu to use Internode's unmetered repositories:

deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid main restricted 
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid restricted main multiverse universe
deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid-updates main restricted
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid-updates restricted main multiverse universe
deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid universe
deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid-updates universe
deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid multiverse
deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid-updates multiverse
deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ intrepid-backports restricted main multiverse universe


This assumes that you're using Ubuntu 8.10, a.k.a. "Intrepid".

Changing the repositories for Fedora

In Fedora the changes are slightly more complicated.  By default, Fedora doesn't point you directly at a repository server at all; it points you as a mirror server.  The mirror server acts as an intermediary between Fedora and the actual repository servers.  When Fedora connects to the mirror server, the mirror works out which is the best performing repository server at that moment in time, and points Fedora towards it.   This is all very laudable in theory; you should pointed at the fastest available repository server at any given time.  However, the people that designed this new system obviously had no experience of data caps!  If you're a on a data cap, you need Linux to go to your ISP's unmetered repository server every time.

Fortunately, we can override this behaviour, but we have to do it in two stages.  First, we have to turn off the mirror system and enable the direct repository system.  Then we have to actually change the repository entries to point to our repositories.  Don't worry; it's not as hard as it sounds.  We have to modify two files in the  /etc/yum.repos.d folder.  The files are fedora.repo and fedora-updates.repo.  

To disable the mirror system and enable direct repository access:
  1. Open a console in Fedora (Applications->System Tools->Terminal).
  2. Change to the Root user by typing "su root" (without quotes) then entering the root password.
  3. Type "gedit /etc/yum.repos.d/fedora.repo: (without quotes).
  4. There should be three lines in the file that start "mirrorlist=".  Comment out all three of those lines by putting a hash symbol at the start of them.  That's disabled the mirror system.



To point towards Internode's repositories:
  1. There should be three lines in the file that start "#baseurl=", but they are all commented out.  Remove the comment (hash symbol) for all three of them.  That's enabled direct repository access, but those three lines are still pointing at Fedora's default repositories, which is no good for us.
  2. For each of the three "base=url" lines, replace the Fedora server with the Internode server, which is ftp://mirror.internode.on.net.  Leave the rest of the text in each of those three lines as it is.
  3. Save the file and close Gedit.


That completes the changes for the fedora.repo file.  You now need to repeat the exact same steps for the fedora-updates.repo file, which is also in the /etc/you.repos.d folder.

Once you've edited and saved both files, you can close the Terminal window if you're finished with it.  If not, remember that you're still the Root user there, so type "Exit" to return to your "ordinary" user and you'll avoid doing any accidental damage.

Comments

1Test comment  09/23/2009 10:21:13 PM  Changing Your Linux Repositories

This is a comment

2Steve Williamson  10/23/2010 8:40:49 PM  Changing Your Linux Repositories

Thanks for that dude. Linux newb here so that was exactly what I needed to know - just had to change 'intrepid' to 'maverick' and I was away!

3Mike Brown  10/24/2010 3:03:59 AM  Changing Your Linux Repositories

You're welcome, Steve.

Actually, things have moved on a fair bit since I wrote this. It's much easier to change your main repositories now.

Just click on System->Administration->Software Sources, then click on the Download From drop-down. You can then pick your country and your ISP from there... assuming it's listed of course. Internode is there under Australia, so that does it for me!

About