• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

add-apt-repository Command Examples

by admin

add-apt-repository is a command line utility that is used to add or enable a repository in the APT (Advanced Packaging Tool) package manager on Debian, Ubuntu, and other Debian-based Linux distributions.

A repository is a collection of software packages that are stored on a remote server and made available for installation on your Linux system. The add-apt-repository command allows you to add a repository to your system’s APT sources list, which is a configuration file that APT uses to find and install packages.

To use add-apt-repository, you need to provide it with the URL of the repository you want to add. For example:

$ sudo add-apt-repository "deb https://myrepo.com/ubuntu bionic main"

This will add the repository at the URL https://myrepo.com/ubuntu to your APT sources list and enable it for installation. You will then need to update your package list using the apt update command before you can install any packages from the new repository.

Keep in mind that you should only add repositories from trusted sources, as adding a repository from an untrusted source could potentially compromise the security of your system.

add-apt-repository Command Examples

1. Add a new apt repository:

# add-apt-repository {{repository_spec}}

2. Remove an apt repository:

# add-apt-repository --remove {{repository_spec}}

3. Update the package cache after adding a repository:

# add-apt-repository --update {{repository_spec}}

4. Allow source packages to be downloaded from the repository:

# add-apt-repository --enable-source {{repository_spec}}

Filed Under: Linux

Some more articles you might also be interested in …

  1. getopt Command Examples in Linux
  2. hlint Command Examples in Linux
  3. lvmdump Command Examples in Linux
  4. nginx 504 gateway time-out
  5. Linux OS Service ‘lm_sensors’
  6. “az appconfig”: Manage App configurations on Azure (Command Examples)
  7. autopkgtest Command Examples in Ubuntu
  8. ipcalc: command not found
  9. What is Soft Links and Hard Links in Linux File System
  10. gitlab-runner Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright