Menu
User

DropVPS Team

Writer: John hens

How to Add APT Repository in Debian 13

How to Add APT Repository in Debian 13

Publication Date

06/15/2026

Category

Articles

Reading Time

2 Min

Table of Contents

APT repositories are software sources used by Debian to download, install, and update packages. While Debian 13 includes official repositories by default, you may need to add additional repositories to access newer software versions, third-party applications, or vendor-specific packages. Learning how to add and manage APT repositories is an important skill for Debian users, VPS administrators, and system administrators.

Step 1: Update the System

Before adding a new repository, update the package database and installed packages.This ensures the system is fully updated before making repository changes.

sudo apt update && sudo apt upgrade -y

Step 2: Check Existing Repositories

Before adding a repository, it is useful to review the repositories already configured on the system.This helps prevent duplicate repository entries.View the main repository file.

cat /etc/apt/sources.list

View additional repository files:

ls /etc/apt/sources.list.d/

Step 3: Add a Repository Using a Sources File

The recommended method in Debian 13 is creating a separate repository file inside the sources.list.d directory.Save the file and exit the editor.Replace the URL with the repository you want to add.

sudo nano /etc/apt/sources.list.d/custom-repo.list

Add the repository entry:

deb http://repository-url/debian trixie main

Step 4: Import the Repository GPG Key

Most third-party repositories require a GPG key to verify package authenticity.This allows APT to trust packages from the repository.

curl -fsSL https://repository-url/key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/repository.gpg

Step 5: Configure the Repository Key

After importing the GPG key, link it to the repository configuration for secure package verification.Using signed repositories improves system security and package integrity.

deb [signed-by=/usr/share/keyrings/repository.gpg] http://repository-url/debian trixie main

Step 6: Update Package Lists

After adding the repository, refresh the package database.APT will download package information from the new repository.Run.

sudo apt update

Step 7: Install Software from the Repository

Once the repository is available, install packages normally using APT.Replace package-name with the software you want to install.

sudo apt install package-name -y

Step 8: Verify the Repository

After updating package lists, verify that Debian can access the repository correctly.This confirms the repository is working properly.

apt policy

You can also search for packages:

apt search package-name

Step 9: Remove an APT Repository

If you no longer need a repository, remove its configuration file.This removes the repository from the system.

sudo rm /etc/apt/sources.list.d/custom-repo.list

Update package lists:

sudo apt update

Step 10: Fix Common Repository Errors

Repository issues may occur because of invalid URLs, missing GPG keys, or incorrect Debian versions.These commands solve many common APT-related problems.Repair broken packages.Clean the package cache.

sudo apt --fix-broken install

Refresh repository data:

sudo apt clean
sudo apt update

 

Linux VPS
🐧Linux VPS

Need a Linux Server for This?

Run Debian, Ubuntu, or any Linux distro on DropVPS — fast NVMe SSD, full root access, and 24/7 support. Perfect for everything you just read.

  • Full Root Access
  • Debian & Ubuntu Ready
  • 99.99% Uptime
  • 24/7 Support
Get Linux VPS →

No commitment · Cancel anytime

U
Loading...

Related Posts