Add Debian 12 | 11 Official Repositories To Sources List

After the installation of Debian 12,11 on a Virtualized Infrastructure or a physical machine you’ll notice APT repositories are not configured correctly. These issue doesn’t apply to Cloud images which have repositories for Debian configured correctly. In this guide we will show you how to add Debian Official repositories to sources list.

If you attempt APT repository update you’ll get an error:

The remedy to this problem is correctly updating sources.list file with Debian default update and security repositories.

Current file contents:

$ cat /etc/apt/sources.list
# deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main

deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main

deb http://security.debian.org/debian-security bullseye-security main contrib
deb-src http://security.debian.org/debian-security bullseye-security main contrib

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ bullseye-updates main contrib
# deb-src http://deb.debian.org/debian/ bullseye-updates main contrib

Add Debian Official repositories to sources list

Run the commands below to add Debian Official repositories to sources.list

  • Debian 11
tee /etc/apt/sources.list<<EOF
deb http://deb.debian.org/debian bullseye main contrib non-free
# deb-src http://deb.debian.org/debian bullseye main contrib non-free

deb http://deb.debian.org/debian bullseye-updates main contrib non-free
# deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free

# deb http://deb.debian.org/debian bullseye-backports main contrib non-free
# deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free

deb http://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
EOF
  • Debian 12
tee /etc/apt/sources.list<<EOF
deb http://deb.debian.org/debian bookworm main contrib non-free-firmware
# deb-src http://deb.debian.org/debian bookworm main contrib non-free-firmware

deb http://deb.debian.org/debian bookworm-updates main contrib non-free-firmware
# deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free-firmware

# deb http://deb.debian.org/debian bookworm-backports main contrib non-free-firmware
# deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main contrib non-free-firmware
# deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free-firmware
EOF

When done, update your APT index to confirm the repositories are working correctly:

$ sudo apt update
Get:1 http://deb.debian.org/debian bullseye InRelease [113 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [36.8 kB]
Get:4 http://deb.debian.org/debian bullseye-backports InRelease [40.9 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main Sources [15.8 kB]
Get:6 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [31.1 kB]
Get:7 http://security.debian.org/debian-security bullseye-security/main Translation-en [16.8 kB]
Get:8 http://deb.debian.org/debian bullseye/main Sources [8612 kB]
Get:9 http://deb.debian.org/debian bullseye/main amd64 Packages [8178 kB]
Get:10 http://deb.debian.org/debian bullseye/main Translation-en [6241 kB]
Get:11 http://deb.debian.org/debian bullseye-backports/main Sources [49.8 kB]
Get:12 http://deb.debian.org/debian bullseye-backports/main amd64 Packages [68.7 kB]
Get:13 http://deb.debian.org/debian bullseye-backports/main Translation-en [50.5 kB]
Fetched 23.5 MB in 5s (4978 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.

Update System

With the official OS repositories added and confirmed to be working let’s update the system packages:

sudo apt upgrade

You can also try distribution minor upgrades if available

sudo apt dist-upgrade

Also install common OS administration tools

sudo apt install git curl bash-completion wget curl vim telnet -y

You now have correct sources.list file on your Debian system. Below are more articles you can read on Debian Linux system:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

One of the most effective control panels for web hosting that is used to host websites and administer web servers […]

Beekeeper Studio is an open-source completely free cross-platform SQL editor and database manager. It is available for Mac, Linux, and […]

OpenResty® is a full-featured web platform that uses our improved Nginx core to scale online applications and services. Its purpose […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.