Table of Contents
Adding an APT repository in Debian 13 allows you to install software packages that are not included in the default repositories or to access newer versions of software. By properly adding trusted repositories, you can safely expand your system’s software options and keep your packages up to date.
STEP 1: Update Your System
Before adding any repository, it’s important to update your package lists to ensure that all software sources are current and compatible
sudo apt update
sudo apt upgrade -y
STEP 2: Add a New Repository Using
Debian allows adding repositories using the add-apt-repository command. This method is quick and automatically updates the system with the new source.
sudo apt install software-properties-common -y # Install if not available
sudo add-apt-repository "deb http://deb.debian.org/debian/ bookworm main contrib non-free"
STEP 3: Add a Repository Manually
If the repository is provided as a URL or .list file, you can add it manually to the sources list. This ensures precise control over which repositories are enabled.
# Create a repository list file
sudo nano /etc/apt/sources.list.d/example-repo.list
Add the repository line:
deb http://deb.debian.org/debian/ bookworm main contrib non-free
STEP 4: Update Package Lists
After adding the repository, update your system’s package lists to include packages from the new source:
sudo apt update
STEP 5: Install Packages from the Repository
Once the repository is added and updated, you can install packages using aptReplace <package-name> with the desired software available from the newly added repository.
sudo apt install <package-name>
STEP 6: Remove a Repository
If a repository is no longer needed, removing it prevents conflicts and keeps your system clean
sudo add-apt-repository --remove ppa:example/ppa
sudo apt update
sudo rm /etc/apt/sources.list.d/example-repo.list
sudo apt update
