K.Mandla's blog of Linux experiences

Howto: Accelerate Ubuntu upgrades with an ISO

This is a fairly useful (and simple, but not very innovative) trick for older machines using Ubuntu, when your network connection might be weak, or when you have a lot of software to install and don’t want to wait on an old CDROM.

You can mount an ISO — such as the alternate or desktop Ubuntu ISOs — to the /media/cdrom0 mountpoint, and use that as a kind of on-disk stash for system files and dependencies. Here’s what I mean.

Get yourself an old computer with a flaky or slow CDROM, and install a command-line Ubuntu system on it. Now use a USB drive or a rewritable CD to copy the alternate ISO onto the drive — not the files, the ISO itself.

Now add that ISO to your sources.list file like this: First, tell apt you’re going to give it more packages to manage.

sudo apt-cdrom add

apt will probably prompt you for the CD now. Rather than inserting the system CD, jump to another terminal and do this, from the directory where you have the ISO.

sudo mount hardy-alternate-i386.iso -o loop -t iso9660 /media/cdrom0/

Now go back to your other terminal where apt is waiting, and press return. apt will think a CD has been inserted, and will add that to your sources.list file. When it’s done, it unmounts it.

Now when you install xorg or whatever, it should prompt you for the CD, so you mount the ISO to /media/cdrom0 again (if you do this a lot, you could set up a script or an alias to take care of it for you, or modify your fstab so you can do it without a lot of typing). This time when you press return, you only have to download a fraction of the packages, thereby saving bandwidth and download time! 😯

Best of all it usually takes only a few seconds to get those packages off the ISO (depending on the speed of your machine, of course 😉 ), so installing should go a lot faster. Remember this trick in April, when you have to make the massive leap from Dapper to Hardy. 😉

(Also remember to manage your cache wisely, so you don’t end up redownloading files after an installation, if you can help it. This ISO thing might also help with that if the versions are the same.)