How to configure multiple repositories with credentials in yum .repo

AuthorFullName__c
Patrick Russell
articleNumber
000001561
FirstPublishedDate
2016-10-06T13:35:56Z
lastModifiedDate
2025-05-15

How to configure multiple repositories with credentials in yum .repo

If you need to supply credentials for private repositories, you can use one of these standard methods instead:


1. Configuration Directives in .repo Files
Define the credentials directly inside your repository configuration file (located in /etc/yum.repos.d/):
[private-repo]
name=My Private RPM Repository
baseurl=https://repo.example.com/artifactory/yum-repo/el7/x86_64/
enabled=1
gpgcheck=1
username=your_username
password=your_password


2. Embed Credentials in the URL
Include the credentials directly within the baseurl:
[private-repo]
name=My Private RPM Repository
baseurl=https://your_username:your_password@repo.example.com/artifactory/yum-repo/el7/x86_64/
enabled=1
gpgcheck=1


3. SSL/TLS Client Certificates (Recommended for Security)
To avoid storing plain-text passwords in repository configuration files, use TLS client certificate authentication:
[private-repo]
name=My Private RPM Repository
baseurl=https://repo.example.com/artifactory/yum-repo/el7/x86_64/
enabled=1
gpgcheck=1
sslclientcert=/etc/pki/tls/certs/client.crt
sslclientkey=/etc/pki/tls/private/client.key
Security Tip:

If plain-text credentials in /etc/yum.repos.d/ are a concern, restrict the repository file permissions so only root can read them:
chmod 600 /etc/yum.repos.d/private-repo.repo