Debian – Update Source List

If you are a Debian administrator, its advisable to run apt-get update before proceed to install any package to make sure that you can get connected to the mirror and the installation will run smoothly with latest package list. Sometimes, you will see following error when trying to update:

W: Some index files failed to download, they have been ignored, or old ones used instead.

This means that the mirror provider which has been setup in your source list is down, or unreachable, or you have routing problem between you and mirror server and any related connectivity problem. So, we need to change the sources list and provide another mirror server which you can get from Debian website, http://www.debian.org/mirror/list . In my case, I will use Japan mirror.

1. Login to the server via SSH/console and open /etc/apt/sources.list via text editor:

[email protected]: ~# nano /etc/apt/sources.list

2. Edit the file following example below. Since I will use Japan mirror, my sources list will be like this:

#
 
# deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official amd64 NETINST Binary-1 20110320-15:00]/ squeeze main
 
#deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official amd64 NETINST Binary-1 20110320-15:00]/ squeeze main
 
deb http://ftp.jp.debian.org/debian/ squeeze main non-free contrib
deb-src http://ftp.jp.debian.org/debian/ squeeze main non-free contrib
 
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free
 
deb http://ftp.jp.debian.org/debian/ squeeze-updates main non-free contrib
deb-src http://ftp.jp.debian.org/debian/ squeeze-updates main non-free contrib

3. Update the package list from new provider:

[email protected]: ~# apt-get update

After you run that, make sure you will see no error at the end of the output. You should able to do apt-get installation without any problem anymore.