Change the Repository on the Raspberry Pi

· 2 min read
Change the Repository on the Raspberry Pi

Changing the repository to the nearest country is needed to speed up the upgrade process or the software installation process on the Raspberry Pi. By default, Raspberry Pi uses the repository from United Kingdom (UK). If your International internet connection is slow, this will slow down the update process or install software on the Raspberry Pi.

Raspbian is a derivative Linux from Debian. We can change its repositories using the mirror closest to our location.

Raspbian provides Mirror Repositories almost all over the world, you can see on page https://www.raspbian.org/RaspbianMirrors. if you are from Indonesia, you can replace the repository with an Indonesian repository.

When this article is written, there are 3 Indonesian repositories. You can test the speed of latency by using the ping command on your PC. If the Indonesian repository is not fast enough, at least you can use the Singapore repository, which is geographically closer to Indonesia.

Indonesian Raspbian Repository
Indonesian Raspbian Repository

To change the repository on Raspbian is very easy. Only needed to edit /etc/apt/sources.list file, then enter the repository URL. In this example, we will try replacing the repository to DATAUTAMA-NET-ID.

sudo nano /etc/apt/sources.list

Comment on the active repository by adding a hash mark (#) at the beginning of the line, then add a new repository above it. I guess the end result is like this.

deb http://kartolo.sby.datautama.net.id/raspbian/raspbian stretch main contrib non-free rpi
#deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
Display Edit Raspbian Repository
Display Edit Raspbian Repository

When done, save it by pressing the CTRL+X button followed by confirmation Y. Make an update so that the Raspbian Package Manager uses a new repository.

sudo apt update
sudo apt upgrade -y

Your Raspbian repository has now moved to the Indonesian repository.