- 论坛徽章:
- 0
|
CentOS的DVD光盘和RHEL5的DVD光盘、构建Yum库的对比(一)
1:CentOS的简单的很。顺手,将CentOS光盘加到自动挂载里面了。因为都是虚拟机的环境。加载镜像就可以了。
操作如下:
[root@rhce ~]# cat /etc/auto.master
#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
[root@rhce ~]# cat /etc/auto.misc
#
# $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage
iso -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
# the following entries are samples to pique your imagination
#linux -ro,soft,intr
ftp.example.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
#floppy -fstype=auto :/dev/fd0
#floppy -fstype=ext2 :/dev/fd0
#e2floppy -fstype=ext2 :/dev/fd0
#jaz -fstype=ext2 :/dev/sdc1
#removable -fstype=ext2 :/dev/hdd
[root@rhce ~]# cd /misc/iso
[root@rhce iso]# ls
CentOS RELEASE-NOTES-cz RELEASE-NOTES-es RELEASE-NOTES-ja RELEASE-NOTES-pt_BR.html RPM-GPG-KEY-CentOS-5
EULA RELEASE-NOTES-cz.html RELEASE-NOTES-es.html RELEASE-NOTES-ja.html RELEASE-NOTES-pt.html TRANS.TBL
GPL RELEASE-NOTES-de RELEASE-NOTES-fr RELEASE-NOTES-nl RELEASE-NOTES-ru
images RELEASE-NOTES-de.html RELEASE-NOTES-fr.html RELEASE-NOTES-nl.html RELEASE-NOTES-ru.html
isolinux RELEASE-NOTES-en RELEASE-NOTES-it RELEASE-NOTES-pt repodata
NOTES RELEASE-NOTES-en.html RELEASE-NOTES-it.html RELEASE-NOTES-pt_BR RPM-GPG-KEY-beta
[root@rhce iso]# tree -d /misc/iso/
/misc/iso/
|-- CentOS
|-- NOTES
|-- images
| |-- pxeboot
| `-- xen
|-- isolinux
`-- repodata
7 directories
[root@rhce iso]# tree -C repodata/
repodata/
|-- TRANS.TBL
|-- comps.xml
|-- filelists.xml.gz
|-- other.xml.gz
|-- primary.xml.gz
`-- repomd.xml
0 directories, 6 files
[root@rhce iso]# cat /etc/yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c4-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c4-media [command]
[c5-media]
name=CentOS-$releasever - Media
#baseurl=file:///media/CentOS/
#
file:///media/cdrom/
#
file:///media/cdrecorder/
baseurl=file:///misc/cd
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta
[root@rhce ~]# yum check-update
Loading "installonlyn" plugin
Setting up repositories
c5-media 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 798 kB 00:00
c5-media : ################################################## 2334/2334
Added 2334 new packages, deleted 0 old in 13.97 seconds
2:RHEL5里面的结构麻烦一点。目前网络的上的DVD都不是官方的,多半都是已经5张合并的。
也是CentOS论坛里面放出的毕竟多。结构如下:
[root@rhce ~]# ls /misc/iso
Cluster README-en.html README-or.html RELEASE-NOTES-de.html RELEASE-NOTES-ml.html RPM-GPG-KEY-fedora
ClusterStorage README-es.html README-pa.html RELEASE-NOTES-en RELEASE-NOTES-mr.html RPM-GPG-KEY-fedora-test
EULA README-fr.html README-pt_BR.html RELEASE-NOTES-en.html RELEASE-NOTES-or.html RPM-GPG-KEY-redhat-auxiliary
eula.en_US README-gu.html README-ru.html RELEASE-NOTES-es.html RELEASE-NOTES-pa.html RPM-GPG-KEY-redhat-beta
GPL README-hi.html README-si.html RELEASE-NOTES-fr.html RELEASE-NOTES-pt_BR.html RPM-GPG-KEY-redhat-former
images README-it.html README-ta.html RELEASE-NOTES-gu.html RELEASE-NOTES-ru.html RPM-GPG-KEY-redhat-release
isolinux README-ja.html README-te.html RELEASE-NOTES-hi.html RELEASE-NOTES-si.html Server
README-as.html README-kn.html README-zh_CN.html RELEASE-NOTES-it.html RELEASE-NOTES-ta.html TRANS.TBL
README-bn.html README-ko.html README-zh_TW.html RELEASE-NOTES-ja.html RELEASE-NOTES-te.html VT
README-de.html README-ml.html RELEASE-NOTES-as.html RELEASE-NOTES-kn.html RELEASE-NOTES-zh_CN.html
README-en README-mr.html RELEASE-NOTES-bn.html RELEASE-NOTES-ko.html RELEASE-NOTES-zh_TW.html
[root@rhce ~]# tree -d /misc/iso
|-- Cluster
| `-- repodata
|-- ClusterStorage
| `-- repodata
|-- Server
| `-- repodata
|-- VT
| `-- repodata
|-- images
| |-- pxeboot
| `-- xen
`-- isolinux
12 directories
提示:RHEL5下Cluster、ClusterStorage、Server、VT目录对应CentOS5下的CentOS,都是RPM包。
在CentOS5中,repodata目录和CentOS目录同级、这也是正确的结构。但是RHEL5中那四个目录下面
都匹配着自己库的的repodata。估计当时制作的时候也是没有办法合并。
进行如下操作,进行测试。创建一个库。
[root@rhce test]# cp /misc/iso/Cluster ./ -r
[root@rhce test]# ls
Cluster
[root@rhce test]# createrepo -v Cluster/
1/32 - Cluster_Administration-it-IT-5.0.0-5.noarch.rpm
2/32 - Cluster_Administration-bn-IN-5.0.0-5.noarch.rpm
3/32 - Cluster_Administration-te-IN-5.0.0-5.noarch.rpm
4/32 - Cluster_Administration-ml-IN-5.0.0-5.noarch.rpm
5/32 - Cluster_Administration-gu-IN-5.0.0-5.noarch.rpm
6/32 - Cluster_Administration-pa-IN-5.0.0-5.noarch.rpm
7/32 - Cluster_Administration-ko-KR-5.0.0-5.noarch.rpm
8/32 - rgmanager-2.0.23-1.i386.rpm
9/32 - Cluster_Administration-fr-FR-5.0.0-5.noarch.rpm
10/32 - Cluster_Administration-zh-TW-5.0.0-5.noarch.rpm
11/32 - piranha-0.8.4-7.el5.i386.rpm
12/32 - cluster-snmp-0.8-27.el5.i386.rpm
13/32 - Cluster_Administration-as-IN-5.0.0-5.noarch.rpm
14/32 - Cluster_Administration-ja-JP-5.0.0-5.noarch.rpm
15/32 - ricci-0.8-30.el5.i386.rpm
16/32 - Cluster_Administration-ru-RU-5.0.0-5.noarch.rpm
17/32 - modcluster-0.8-27.el5.i386.rpm
18/32 - Cluster_Administration-pt-BR-5.0.0-5.noarch.rpm
19/32 - Cluster_Administration-kn-IN-5.0.0-5.noarch.rpm
20/32 - Cluster_Administration-mr-IN-5.0.0-5.noarch.rpm
21/32 - system-config-cluster-1.0.39-1.0.noarch.rpm
22/32 - Cluster_Administration-de-DE-5.0.0-5.noarch.rpm
23/32 - Cluster_Administration-si-LK-5.0.0-5.noarch.rpm
24/32 - Cluster_Administration-zh-CN-5.0.0-5.noarch.rpm
25/32 - luci-0.8-30.el5.i386.rpm
26/32 - Cluster_Administration-ta-IN-5.0.0-5.noarch.rpm
27/32 - cluster-cim-0.8-27.el5.i386.rpm
28/32 - Cluster_Administration-or-IN-5.0.0-5.noarch.rpm
29/32 - Cluster_Administration-es-ES-5.0.0-5.noarch.rpm
30/32 - ipvsadm-1.24-8.1.i386.rpm
31/32 - Cluster_Administration-hi-IN-5.0.0-5.noarch.rpm
32/32 - Cluster_Administration-en-US-5.0.0-5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@rhce test]# mv Cluster/repodata/ ./
[root@rhce test]# tree repodata/
repodata/
|-- filelists.xml.gz
|-- other.xml.gz
|-- primary.xml.gz
`-- repomd.xml
0 directories, 4 files
[root@rhce yum.repos.d]# cat /etc/yum.repos.d/CentOS-Test.repo
[Cluster]
name=CentOS-$releasever - Media
baseurl=file:///root/test
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta
[root@rhce yum.repos.d]# yum check-update
Loading "installonlyn" plugin
Setting up repositories
Cluster 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 5.7 kB 00:00
Cluster : ################################################## 32/32
Added 32 new packages, deleted 0 old in 0.30 seconds
做了上面的库,就可以安装了吗?不是的,还是缺少文件,无法解决依赖关系。
用createrepo可以产生上面的那四个文件:
|-- filelists.xml.gz 所有RPM包的文件列表,可以通过yum whatprovides查询
|-- other.xml.gz 扩展信息、包括changelogs信息
|-- primary.xml.gz RPM包内的文件列表,也包含依赖信息。可以通过rpm -qpl查询,返回相关信息。
`-- repomd.xml 这里是时间戳和文件MD5信息含其它上述三个文件。每次连接后,都刷新此文件。
下面这个文件不知道怎么产生的。我用createrepo没有创建出来。但是CentOS里面有,RHEL5里面也有。
|-- comps.xml 这个文件包含软件包组的信息,并有优化的依赖解决方案。
晕!以后再解,郁闷!
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/36549/showart_433138.html |
|