Friday, 22 March 2013

How to update apt-get repositories in your old Linux distribution?

Are you using a Linux distribution that is really old?.
The apt-get repositories for the distribution are not supported anymore, but you would like to update the repositories so that you can install new packages?

Cool, so here it's how to do that:

You need to update /etc/apt/sources.list with new (valid) urls. e.g. in Ubuntu 11.04 (Maverick, no longer supported) you might want to update the URLs to (for example) "oneiric". You might have to do the following:
1) Backup /etc/apt/sources.list
2) Find and replace (inline) the old distro name ("maverick" in this example) with the new one ("oneiric" in this example)
3) Update apt-get cache to see the changes reflected.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo sed -i 's/maverick/oneiric/g' /etc/apt/sources.list
sudo apt-get update
And that's it, make sure the replaced sources.list file has the same permissions as the original one and bear in mind that you might want to use "sudo" since /etc/apt is usually owned by root.