代码改变世界

创建本地yum源及grouplist 出错

2014-11-11 11:33 梁小白 阅读(...) 评论(...) 编辑 收藏

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 grouplist
  一般情况下在执行yum grouplist时会报错Setting up Group Process Error: No group data available for       configured repositories,这是因为源里缺少comps****.xpm文件造成的,这个文件可以在/home/unixer0 /Local_yum_source/Workstation/repodata(根据你的源位置)找到,不过名字并不是comps***而是一些数字字母组合,后面会跟着comps****.xpm例如6107d2dc7436b6e577ca7c20a552c687b224aa60b04bde96a862141bcdecbb36-comps-rhel6-Workstation.xml
复制这个文件到/home/unixer0/Local_yum_source目录下,并重新命名为comps-rhel6-Workstation.xml这样就可以了。重新执行上面的命令,好了,本地源就建立完成了。
  5.可以打开add/remove software看下了,当然,要在它的设置部分system>software sources里勾选你刚建立的源,例如my_local_source.