首页 > 代码库 > 创建本地yum源时遇到的坑

创建本地yum源时遇到的坑

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

yum install createrepo

createrepo /your/repo/directory/

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

[root@localhost rpms]# yum install opensslLoaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Setting up Install ProcessResolving 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 ResolutionDependencies Resolved===================================================================================================================================================================================================== Package                                   Arch                                     Version                                               Repository                                            Size=====================================================================================================================================================================================================Updating: openssl                                   x86_64                                   1.0.1e-16.el6_5.7                                     rhel-gmtadj-source                                   1.5 MTransaction Summary=====================================================================================================================================================================================================Upgrade       1 Package(s)Total download size: 1.5 MIs this ok [y/N]: yDownloading 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-sourceerror 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]# lltotal 1548-rw-r--r-- 1 root root 1578640 Nov 10 18:42 openssl-1.0.1e-16.el6_5.7.x86_64.rpmdrwxr-xr-x 2 root root    4096 Nov 11 12:21 repodata[root@localhost rpms]# pwd/var/www/html/rpms

 正确的是

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

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

 

创建本地yum源时遇到的坑