Artifactory 5.4.6环境下如何配置YUM客户端使用RPM虚拟仓库
Hey there! I’ve worked with Artifactory 5.x quite a bit, so let’s break down exactly how to get your YUM client pointing to that virtual RPM repo you’ve set up.
Step 1: Create a YUM Repository Configuration File
On your YUM client machine, create a new .repo file in the /etc/yum.repos.d/ directory. Let’s name it something descriptive, like artifactory-virtual-rpm.repo.
Use your favorite editor (like vi or nano) to add the following content, replacing placeholders with your actual Artifactory details:
[artifactory-virtual-rpm] name=Artifactory Virtual RPM Repository baseurl=http://<your-artifactory-server-ip-or-domain>:8081/artifactory/api/yum/<your-virtual-repo-name> enabled=1 gpgcheck=0 # Uncomment and fill these if your repo requires authentication # username=<your-artifactory-username> # password=<your-artifactory-api-key-or-password>
Note: If your Artifactory uses HTTPS, swap
http://forhttps://in thebaseurl. Using an API key (generated from your Artifactory user profile) instead of a plaintext password is way more secure.
Step 2: Verify the Repository Setup
First, clear YUM’s cached data to ensure it picks up the new repo:
yum clean all
Then check if the repo is recognized:
yum repolist
You should see artifactory-virtual-rpm listed with the count of available packages.
Step 3: Test the Configuration
To confirm everything works, try searching for a package hosted in your virtual repo:
yum search <target-package-name>
Or test installing a package:
yum install <target-package-name>
Quick Troubleshooting Tips
- If you hit auth errors, double-check your username and API key/password in the
.repofile. - If the repo doesn’t show up in
repolist, verify thebaseurlis correct—test accessing it directly via a browser orcurlto confirm reachability. - For Artifactory 5.4.6 specifically, make sure your virtual repo is configured to include your local and remote RPM repos correctly (check this in the Artifactory web UI under Repositories > Virtual).
内容的提问来源于stack exchange,提问作者Vishwa

