Skip to content
Search RunEntLinux

Searches general documentation on RunEntLinux. Each distribution has its own documentation search.

    Browse this documentation

    Repository Management

    Applies to CentOS Stream 9 & 10 / AlmaLinux 9.x & 10.x / Rocky Linux 9.x & 10.x

    Software repositories are the sources from which DNF obtains packages. Properly managing repositories is a fundamental system administration skill — you need to know which repositories are configured on your system, how to add new ones, and how to control repository priority.

    • View and manage configured repositories
    • Enable and disable repositories
    • Add third-party repositories
    • The structure of .repo files
    • Configure repository priorities
    • Use dnf config-manager
    • A system with EL 9.x / 10.x installed
    • A user account with sudo privileges
    • The system is connected to the internet
    • Familiarity with DNF Basics
    View currently enabled repositories
    $ dnf repolist

    Example output:

    repo id repo name
    appstream AlmaLinux 9 - AppStream
    baseos AlmaLinux 9 - BaseOS
    extras AlmaLinux 9 - Extras

    List All Repositories (Including Disabled)

    Section titled “List All Repositories (Including Disabled)”
    View all repositories
    $ dnf repolist all

    Example output:

    repo id repo name status
    appstream AlmaLinux 9 - AppStream enabled
    appstream-debug AlmaLinux 9 - AppStream - Debug disabled
    appstream-source AlmaLinux 9 - AppStream - Source disabled
    baseos AlmaLinux 9 - BaseOS enabled
    baseos-debug AlmaLinux 9 - BaseOS - Debug disabled
    baseos-source AlmaLinux 9 - BaseOS - Source disabled
    crb AlmaLinux 9 - CRB disabled
    extras AlmaLinux 9 - Extras enabled
    View detailed information about a repository
    $ dnf repoinfo baseos

    Example output:

    Repo-id : baseos
    Repo-name : AlmaLinux 9 - BaseOS
    Repo-status : enabled
    Repo-revision : 1711234567
    Repo-updated : Mon 24 Mar 2026 08:00:00 AM CST
    Repo-pkgs : 1,842
    Repo-available-pkgs: 1,842
    Repo-size : 1.5 G
    Repo-baseurl : https://repo.almalinux.org/almalinux/9/BaseOS/x86_64/os/
    Repo-expire : 86,400 second(s) (last: Mon 24 Mar 2026 10:15:00 AM CST)
    Repo-filename : /etc/yum.repos.d/almalinux-baseos.repo

    All repository configuration files are stored in the /etc/yum.repos.d/ directory with a .repo extension.

    List repo configuration files
    $ ls /etc/yum.repos.d/

    A typical .repo file looks like this:

    /etc/yum.repos.d/almalinux-baseos.repo example (EL 9)
    [baseos]
    name=AlmaLinux $releasever - BaseOS
    baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/
    enabled=1
    gpgcheck=1
    countme=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9
    metadata_expire=86400
    /etc/yum.repos.d/almalinux-baseos.repo example (EL 10)
    [baseos]
    name=AlmaLinux $releasever - BaseOS
    baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/
    enabled=1
    gpgcheck=1
    countme=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10
    metadata_expire=86400

    gpgkey differs by major version (-9 / -10) and is not tied to $releasever; defer to the repo files shipped by the system’s almalinux-release package.

    Field descriptions:

    FieldDescription
    [baseos]Repository ID, a unique identifier
    nameRepository name, used for display purposes only
    baseurlThe URL of the repository
    mirrorlistMirror list URL (use either this or baseurl)
    enabled1 to enable, 0 to disable
    gpgcheck1 to enable GPG signature verification, 0 to disable
    gpgkeyPath to the GPG public key
    metadata_expireMetadata expiration time (in seconds)
    priorityRepository priority (requires dnf-plugins-core)

    Both EL 9 and EL 10 use DNF 4 (EL 10 ships 4.20), so the config-manager syntax is the same:

    Disable a repository
    $ sudo dnf config-manager --set-disabled crb
    Enable a repository
    $ sudo dnf config-manager --set-enabled crb
    Verify the change
    $ dnf repolist | grep crb
    crb AlmaLinux 9 - CRB

    Temporarily Enabling/Disabling Repositories

    Section titled “Temporarily Enabling/Disabling Repositories”

    If you only want to use a repository for a single operation without modifying the configuration:

    Temporarily enable a repository to install a package
    $ sudo dnf install --enablerepo=crb some-devel-package
    Temporarily disable a repository
    $ sudo dnf update --disablerepo=epel

    Method 1: Install a Repository RPM Package

    Section titled “Method 1: Install a Repository RPM Package”

    Most well-known third-party repositories provide RPM packages that automatically configure the repository:

    Using EPEL as an example
    $ sudo dnf install epel-release

    This will automatically create the corresponding .repo file under /etc/yum.repos.d/ and import the GPG key.

    Add a repository URL directly
    $ sudo dnf config-manager --add-repo https://example.com/repo/el9/example.repo

    This downloads the remote .repo file to /etc/yum.repos.d/.

    1. Create the .repo file

      Create a custom repository configuration
      $ sudo vi /etc/yum.repos.d/my-custom.repo

      Enter the following content:

      [my-custom-repo]
      name=My Custom Repository
      baseurl=https://repo.example.com/el9/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=https://repo.example.com/RPM-GPG-KEY-example
    2. Refresh the cache

      Clear and rebuild the cache
      $ sudo dnf clean all
      $ sudo dnf makecache
    3. Verify the repository is active

      Confirm the new repository appears in the list
      $ dnf repolist

    When multiple repositories provide packages with the same name, you can use priorities to control which repository DNF prefers.

    1. Ensure dnf-plugins-core is installed

      Install the DNF plugin package
      $ sudo dnf install -y dnf-plugins-core
    2. Edit the repository configuration file and add the priority field

      Edit the repository file
      $ sudo vi /etc/yum.repos.d/epel.repo

      Add the following under the [epel] section:

      priority=10

    Priority rules:

    • Lower numbers mean higher priority
    • The default priority is 99
    • It is recommended to keep official repositories at the default or a high priority, and set third-party repositories to a lower priority
    RepositoryRecommended Priority
    baseos / appstream10 (default is fine)
    EPEL20
    Other third-party repositories30 or higher

    EL 9 and EL 10 (DNF 4.20) use the same syntax:

    View a repository's configuration
    $ dnf config-manager --dump baseos
    Set an option for a repository
    $ sudo dnf config-manager --save --setopt=epel.priority=20
    Add a remote repository file
    $ sudo dnf config-manager --add-repo https://example.com/repo.repo
    Enable a repository
    $ sudo dnf config-manager --set-enabled <repo-id>
    Disable a repository
    $ sudo dnf config-manager --set-disabled <repo-id>

    ”Cannot find a valid baseurl for repo”

    Section titled “”Cannot find a valid baseurl for repo””

    This is typically a network issue or an invalid repository URL:

    Check network connectivity
    $ curl -I https://repo.almalinux.org/
    If using a mirrorlist, check if DNS is working properly
    # Note: mirrorlist.centos.org was retired with CentOS Linux 7 EOL (2024-06);
    # Stream 9/10 mirrorlists point at mirrors.centos.org (MirrorManager), not the old hostname
    $ dig mirrors.centos.org

    If your repo files still say mirrorlist.centos.org, that is an EL7-era configuration: on Stream 9/10 it fails to resolve or returns an empty list — switch to mirrors.centos.org, or point baseurl at a usable mirror. Servers in China usually also need a domestic mirror.

    Using Alibaba Cloud mirrors as an example, edit the corresponding .repo file and replace the baseurl with the Alibaba Cloud address:

    Back up the original configuration
    $ sudo cp /etc/yum.repos.d/almalinux-baseos.repo /etc/yum.repos.d/almalinux-baseos.repo.bak

    The repository’s GPG key may not have been imported:

    Manually import a GPG key
    $ sudo rpm --import https://repo.example.com/RPM-GPG-KEY-example
    View imported GPG keys
    $ rpm -qa gpg-pubkey*