Most users of Linux based operating systems such as Ubuntu are familiar with BitTorrent. In fact, Ubuntu even comes with a BitTorrent client, and millions of Ubuntu users got their install disk via the popular filesharing protocol.
When it comes to upgrading their OS, however, most users still rely on Ubuntu’s central servers. Because of this, the servers are overloaded with upgrade requests every time a big update is released, which often causes them to crash. The next Ubuntu update, version 8.10 aka Intrepid Ibex is scheduled to be released this week, and since the OS is more popular than ever, updating might be troublesome.
There is an easy solution to this problem though. One that not only prevents the Ubuntu servers from crashing, but also speeds up the update progress, because it uses BitTorrent. A bunch of TorrentFreak readers were kind enough to write a basic tutorial to guide you through the upgrade process, which we have posted below.
Update to Ubuntu ‘Intrepid Ibex’ using BitTorrent
Step 1: Setting sources.list to a close-local mirror
First off, it’s definitely recommended to reset to a local mirror. This way, you will download any needed files from a closer and supposedly faster source.
Either do an auto-check: System -> Administration -> Software Sources -> Download From: -> Other -> Select Best Server (It’ll run a couple hundred tests (takes less than five minutes) and select the best mirror for you. Make sure to remember which mirror it is, because you will need that later.)
Or select your local mirror yourself according to your country.
Step 2: Disable 3rd Parties repositories
It is also very much recommended to disable 3rd party repositories! If you don’t know exactly what you are doing, go to the 3rd Parties tab and deselect all of the entries there.
Step 3: Install apt-p2p
Next you need to install “apt-p2p”. Version 0.2.5 is needed because of a major bug in older versions. This is beta software, so it might not be stable for everybody. If it can’t download the file via BitTorrent, however, it will revert to http download.
As apt-p2p is not in the hardy repos yet, we have to fetch it from a server directly. Below I have have two scripts for 32-bit and 64-bit. Use the one that matches your OS.
Save the script file as “apt-p2p.sh” on your desktop. Then open a terminal (Applications > System > Terminal) and issue these commands (you’ll be prompted for your user password):
sudo sh apt-p2p.sh
The scripts will create a apt-p2p folder in the /temp folder, enter that folder and download apt-p2p from the intrepid repositories (they work fine on hardy), including all dependencies. Finally, it will install everything in the required order.
Step 4: Prepare the sources.list
Once installed type the following:
gksudo gedit /etc/apt/sources.list
Now you are looking at the sources.list file for Ubuntu; this specifies which servers to contact for updates and new programs. You should see a bunch of lines that look similar to this:
deb http://archive.canonical.com/ubuntu hardy partner
deb-src http://archive.canonical.com/ubuntu hardy partner
deb http://*mirror-address*/ubuntu/ hardy main universe restricted multiverse
deb-src http://*mirror-address*/ubuntu/ hardy main universe restricted multiverse
where **mirror-address** is the address of the mirror you chose earlier.
Don’t worry, you may not have all of these, and you may have more. However, you only want to change ones that are similar to these. You want to change these to look like this:
deb http://localhost:9977/archive.canonical.com/ubuntu hardy partner
deb-src http://localhost:9977/archive.canonical.com/ubuntu hardy partner
deb http://localhost:9977/*mirror-address*/ubuntu/ hardy main universe restricted multiverse
deb-src http://localhost:9977/*mirror-address*/ubuntu/ hardy main universe restricted multiverse
So basically just insert “localhost:9977” after the “http://”. Now close the program and save the file. Note: If you messed anything up, go back to the terminal and run this command:
This WILL overwrite your sources.list file with your backup and we are almost done!
Step 5: Update the packages & upgrade to Intrepid
Back at the terminal, type the following command:
This will update the list of software, as well as fully integrate apt-p2p. If you get any errors, run the following commands (Warning: If not done carefully, these commands could destroy your system):
sudo apt-get update
Once everything looks okay, you’ll want to forward the ports for apt-p2p to your system (if you have a router, see http://portforward.com, port for apt-p2p is 9977 TCP and UDP). At this point, you’re all set to receive regular updates via BitTorrent. If you want to upgrade to Intrepid ahead of time you may type one of the following commands in the terminal:
Click on the “upgrade” button on the top right of that window and follow the wizard. When asked, that no valid mirror was found and whether it shall replace hardy with intrepid, then select “Yes”.
Note: When issuing a “dist-upgrade” in the terminal you will first need to manually alter the entries in the sources.list from “hardy” to “intrepid”.
Now you’re all set, and by using BitTorrent to update Ubuntu you will be updated much faster, and help relieve the strain on the update servers on launch day. As always, tips and suggestions are welcome in the comments.