Installing Software on Old Ubuntu Installs

Written on March 29, 2012

Have an old Ubuntu server or desktop and can't access the repositories? Getting messages like:

Err http://us.archive.ubuntu.com karmic-updates/main Packages
  404  Not Found [IP: 91.189.92.181 80]

And:

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/karmic-security/main/binary-i386/Packages.gz  404  Not Found [IP: 91.189.92.167 80]

Here are a couple of sed one-liners to fix it for you.

sudo sed -i 's/us.archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo sed -i 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

Obviously, adjust the original mirror (us.archive.ubuntu.com) to whichever mirror you usually use if necessary.

Then, update and install your package:

sudo apt-get update
sudo apt-get install <your-package>

Enjoy!

Written on March 29, 2012