← Packages & Services
Linux · Packages & Services
How to manage software repositories in Linux
List and add software repositories with dnf config-manager and add-apt-repository, and enable or disable repos.
List the configured repositories, and add or toggle them. Run as root to change repository configuration.
Adding a third-party repository lets it install and update software on your system with root privileges. Add only repositories you trust, and prefer signed ones.
# List repositories
dnf repolist # RHEL/OL
apt policy # Debian/Ubuntu (shows sources)
# Enable / disable a repo (RHEL/OL)
sudo dnf config-manager --set-enabled <repo>
sudo dnf config-manager --set-disabled <repo>
# Add a repo
sudo dnf config-manager --add-repo <url>.repo # RHEL/OL
sudo add-apt-repository ppa:<owner>/<name> # Ubuntu
# Repo files live here
ls -l /etc/yum.repos.d/ # RHEL/OL
ls -l /etc/apt/sources.list.d/ # Debian/UbuntuLinuxRepositoriesdnf