Use BitTorrent to Upgrade to Ubuntu ‘Intrepid Ibex’
Written by Ernesto on October 29, 2008Ubuntu, the open source GNU/Linux based operating system, is about to release its next big update - Intrepid Ibex. In the past, the update servers would crash very quickly on a big release day, making it hard for people to get the latest update. With BitTorrent, however, this can be easily avoided.
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.
For 32bit versions use this script, and for 64bit versions use this script.
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”.
or use
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.
Previously: P2Pnet Wins Landmark ‘Hyperlinking” Case
Next: Lawyers Forced to Drop P2P ‘Wireless Defense’ Case





42 Responses
hmm this is quite good, even if the update server goes down you’ll still be leeching it :)..
Thank you, I’m very excited about upgrading this way :)
It should be interesting to see not only how well this works, but how well it works after the initial upgrade. If it works as well as I’d expect, it would be nice to see this built into Ubuntu.
This “tutorial’ is overly complex and completely unnecessary.
Download the Ubuntu torrent from their website (or a mirror), burn the ISO file to disc, reboot and select ‘upgrade’ from the menu. Done.
How does apt-p2p seed? Is it then always running in the background? Or are there many dedicated seeds out there and those who use it are essentially leechers?
The Difference between Windows and Linux
Windows loves it when its parties are gatecrashed and the house is trashed, forcing you to spend hundreds in repairs.
Linux is a snobby cult, where you have to learn how to think, eat, breath and shit in programming code, but at least, unlike a certain OS we know, it doesn’t throw beer-bashes.
@4, My thought exactly, but I think you and I are missing something that this “longer version” tutorial is talking about, as to what… maybe further comments will help out.
Cheers!
http://www.eZee.se
@6 I remember the days where you had to eat shit and die programming code for that other OS, too.
Users overwhelmed by the complexity of this tutorial (most of which is related to installing software that isn’t yet in Ubuntu) may want to try debtorrent, which is very similar in function and is available to all Hardy Heron users.
Just ‘apt-get install debtorrent apt-transport-debtorrent’ and then check out the man page for debtorrent-client.
Yikes! In the 2nd paragraph you have linked to Alpha 1 (5 months old) and not the final release. Link to this page for bittorrent links:
http://releases.ubuntu.com/8.10/
Sweet. I’ve been getting max of 1mb every time I use apt-get where I’m at so this should boost my speed alot
I agree with the advice from Anonymous to just download a iso as a torrent and burn it to make an upgrade disk.
apt-p2p looks interesting, but a bit premature, complicated and risky to me. The shell script bypasses the normal packaging process and installs versions of important things like python-pysqlite2. And the apt-p2p script documentation says it takes up to 10 seconds to find each package. I don’t see any benchmarks comparing performance of this new scheme with a standard bittorrent download for doing an upgrade - are there any?
So, does this work in conjunction with local network apt mirrors?
That is, can I have this machine torrent the update and have the other machines on the local network then update using this one?
“It is not based on BitTorrent at all, except that the downloading of data from peers uses methods inspired by BitTorrent.”
Ubuntu is shit
Fedora FTW
“Do I need to forward ports?
Yes, you definitely do. Due to the use of a DHT built on UDP, peers must be able to contact each other. If a peer is not able to contact you, it will drop connections to you in the DHT. This will adversely affect your ability to lookup files in the DHT.”
Well, that sucks. Not only do I have to open ports in my firewall, it will only work at ONE computer unless you got one Internet connection for every computer in your house. Didnt think so…
I’ve never downloaded updates as fast as I do now. Even the simple ’sudo apt-get update’ has speed up after changing to torrents.
thanks for sharing.
I’d like to remind the fedora fans of something really quick, may I?
http://www.google.com/trends?q=apple%2C+ubuntu%2C+fedora%2C+suse%2C+debian
Infer from that what you will.
I’ll definitely download the latest version of Ubuntu on BitTorrent.
Changing “hardy” to “intrepid” in your sources.list and running “sudo apt-get dist-upgrade” is NOT recommended for upgrading between releases as update manager does extra checks and cleanup. If you want to upgrade from the terminal use do-release-upgrade:
https://help.ubuntu.com/community/IntrepidUpgrades#Network%20Upgrade%20for%20Ubuntu%20Servers%20(Recommended)
@19 Amazing point FTW!!!
I’d like to address some comments on the article (I’m the original author of everything but the intro and section three, which is a bit too complicated).
BTW, I didn’t write in this article for fame or recognition, I wrote it in because I’m really into BitTorrent and I wanted to see if I could basically cause the largest ever linux distribution upgrade via BitTorrent (yes, I know it’s not exactly BitTorrent, but it’s close enough, and I know that lots more people will download the torrents than use this guide, but I’m talking about automatic p2p upgrades).
First off, instead of doing section three, just download and run http://debian.camrdale.org/pool/main/a/apt-p2p/apt-p2p_0.1.5_all.deb It should be compatible with Hardy Heron (at least, all the requirements stated at the author’s homepage exist in Hardy repos).
To the comments saying “just download the ISO on a torrent, burn it to a CD, reboot to the CD, and upgrade from there” I say “just install apt-p2p, change your sources, and run update-manager -d”. I even managed to eliminate a step ;) But seriously, I find burning a CD to be a real bother, not to mention all the reliability problems Ubuntu has historically had due to failed CD burns. And this will be automatic for the future. Besides, what’s wrong with another way of doing things?
For the user that said you should just install debtorrent, DON’T!!! From what I can gather on the author’s website (and the reason I chose apt-p2p instead of debtorrent) it requires changes to the repositories and the repo server which I’m not aware of being available on ubuntu/canonical servers or mirrors, just Debian’s. Besides, if you ignore step 3 and just download the above torrent, or replace step 3 with “install debtorrent”, you get the same result (but change port 9977 for 9988).
For the person inquiring about speed, I honestly have no idea, it could be faster for some people (especially on a LAN), but it’s more about relieving strain on canonical servers and increasing reliability.
That leads right into the next comment, asking if you can use this as a mirror for a local network. Yes! In fact, this is very simple. At the terminal type this:
gksu gedit /etc/apt-p2p/apt-p2p.conf
For your non-mirror machines you want to set the following:
MIN_DOWNLOAD_PEERS = 0 (forces download from peers)
LOCAL_OK = yes (this is set on all machines)
BOOTSTRAP = (add your system in here on the non-mirror systems i.e. 192.168.1.1:9977)
BOOTSTRAP_NODE = YES (only on the mirror machine)
With those changes your systems should automatically connect to your main system to request DHT peers (which would be each other and the mirror) and start downloading.
For the person asking about ports, you do need an open port for each machine, but you can specify which port in the above config file. Or have one machine public and the rest configured as above.
And about do-release-upgrade, I’m not sure if I’d do that. Or apt-get dist-upgrade. Or update-manager -d. Update-manager -d wants to disable third party repos (will it disable the ones we changed? I don’t know!). An apt-cache bug (apt-cache is very similar to this in function) said don’t use do-release-upgrade. And while apt-get dist-upgrade won’t have the previous problems, it may have its own. I didn’t test this on a hardy machine, after all.
One last bit of advice: I did this when already on Intrepid Ibex (apt-get install apt-p2p then follow the rest of the instructions). I already had all of my packages installed and downloaded at this point, so to get all the packages into apt-p2p I had to do this:
cd /var/cache/apt/archives
mkdir ../archives1
mv *deb ../archives1
dpkg –get-selections \* | grep install | grep -v deinstall | sed -e “s/\s.*$//” | sed ’s/^/sudo apt-get install –reinstall –download-only -y -q /g’ | sh | tee progress.log
This redownloaded all of my packages, making sure they went through apt-p2p.
@13 You can use it in conjunction with a local mirror just fine, my setup is this:
Crappy dell desktop from 2001 acting as a server running apt-cacher-ng (caching apt proxy) and apt-p2p, with each sources.list line being something like:
deb http://localhost:9977/ftp.iinet.net.au/ubuntu/ intrepid main
(iiNet is my ISP, and their mirror is not counted on my bandwidth limit, still its better than most australian isp’s :P)
Then on every other box i just have:
deb http://dellserverIP/ubuntu intrepid main.
This way if on my laptop I try to install… apache2 for example, first it checks on my dell box, if it has it, just copies from there, if not, the dell box downloads the package via apt-p2p and my laptop then downloads near instantly over the LAN :P.
P.S. I noticed you mentioned local apt mirror and not a caching proxy, but it should work pretty much the same way, configure your mirror’s mirror.list using the localhost:9977 prefix as above and it should work just the same. I just prefer the caching proxy to a full mirror as I only have a local copy of packages I actually need.
People saying such things haven’t even used Linux/Unix. They’re just generating some shit to sound leet on public boards.
Proven fact. ;)
Thats secure ?
I switched over to Linux about 4 months ago and WISH I would have done so YEARS ago. Linux totally ROCKS.
Jiff
http://www.online-anonymity.kr.tc
@4 Agree this is too complex. Why isn’t there are .deb?
We’re also mirroring most of the Ubuntu torrents at linuxtracker.org.
http://linuxtracker.org/index.php?page=torrents&category=30
Thanks for the help, however people should probably use
“sudo update-manager -d”
instead of dist-upgrade to update to the newest version. I am told that dist-upgrade is deprecated.
http://dmz-gw.darktech.org.uk/ubuntu-8.10-desktop-i386.iso
a mirror for you guys.
I’ll wait a month, then upgrade at my leisure. Its Halloween, there’s other stuff to do.
“Next you need to install “apt-p2p”. Version 0.2.5 is needed because of a major bug in older versions.”
Article talks about version 0.2.5 even though the newest version is only 0.1.5.
This is probably a good idea for the ones using the main servers, but for me, using the Norwegian mirror is blazingly fast, compared to using BitTorrent, which was actually painfully slow. I’m looking at 1500kB/s, so about 8-9 minutes to download the whole schmaloney….
Well, good idea, anyway. Too bad it didn’t do it for me… :)
Holy shit I’m getting 781KB/s!
thank god iwont have to wait 2 days to update lol
“Well, that sucks. Not only do I have to open ports in my firewall, it will only work at ONE computer unless you got one Internet connection for every computer in your house. Didnt think so…”
or you could, you know, change the default port? you still have to open a port on the firewall but you can have 60000 pcs in your NAT all using apt-p2p if you want…
“This “tutorial’ is overly complex and completely unnecessary.
Download the Ubuntu torrent from their website (or a mirror), burn the ISO file to disc, reboot and select ‘upgrade’ from the menu. Done.”
If you weren’t such an idiot, you would actually READ the title of this article which is UPGRADE not INSTALL. This article points out an alternative way to download the UPDATES to the system without running into the issue where the main ubuntu servers could crash on release day.
Ignorance is not bliss…idiot.
There are much easier instructions on using bittorrent to upgrade here: http://ubuntuforums.org/showthread.php?p=4784633#post4784633 It’s just simply downloading the alternate CD/DVD ISO over bittorrent, then either burning it to a CD or mounting it directly which in either case will automatically bring up the upgrade dialog and will let you upgrade that way
awesome ~ gonna upgrade soon!
You can also find a visually appealing easy way to upgrade to ubuntu at the following link :
http://linuxandfriends.com/2008/10/31/upgrading-to-ubuntu-810-desktop-in-8-easy-steps/
It takes just 8 simple steps.
People that diss Linux are just faggots that can’t understand it. No, really, they are. That’s why their doing it in the first place, except to kiss Bill’s rich a$$.
47 references to this post
Responses are closed
All remaining responses will continue to be archived. Use the TorrentFreak forums if you want to discuss something.