创建本地yum源时遇到的坑

RHEL有时候使用自定义的YUM源是很方便的事情。

yum install createrepo

createrepo /your/repo/directory/

不过由于粗心,本人在使用时遇到很郁闷的坑,错误如下:

[root@localhost rpms]# yum install openssl
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package openssl.x86_64 0:1.0.1e-15.el6 will be updated
---> Package openssl.x86_64 0:1.0.1e-16.el6_5.7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
 Package                                   Arch                                     Version                                               Repository                                            Size
=====================================================================================================================================================================================================
Updating:
 openssl                                   x86_64                                   1.0.1e-16.el6_5.7                                     rhel-gmtadj-source                                   1.5 M

Transaction Summary
=====================================================================================================================================================================================================
Upgrade       1 Package(s)

Total download size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:


Error Downloading Packages:
  openssl-1.0.1e-16.el6_5.7.x86_64: failed to retrieve openssl-1.0.1e-16.el6_5.7.x86_64.rpm from rhel-gmtadj-source
error was [Errno 2] Local file does not exist: /var/www/html/rpms/-o/openssl-1.0.1e-16.el6_5.7.x86_64.rpm

其它都正常就是下载不了文件。

经过很长时间的郁闷排查后,发现其实原来,创建repo的时候,RPM包一定要放在REPO目录下面的子目录中

下面的REPO是错误的

[root@localhost rpms]# ll
total 1548
-rw-r--r-- 1 root root 1578640 Nov 10 18:42 openssl-1.0.1e-16.el6_5.7.x86_64.rpm
drwxr-xr-x 2 root root    4096 Nov 11 12:21 repodata
[root@localhost rpms]# pwd
/var/www/html/rpms

 正确的是

[root@nfsserver local-yum]# ll
total 8
drwxr-xr-x. 2 root root 4096 Nov 11 19:26 repodata
drwxr-xr-x. 2 root root 4096 Nov 11 19:25 x86_64
[root@nfsserver local-yum]#

 X86_64中才是你要安装的RPM包。

 

你可能感兴趣的:(yum)