感谢支持
我们一直在努力

配置RHEL6.2的YUM源

服务器端:
1、    由于yum安装支持三种协议:file://、ftp://和http://,因此如果是使用本地文件作为源,则可直接使用file:\\协议,否则需要先准备好ftp或者http服务。这次测试的是ftp源,因此需要配置好ftp服务,并且要把ftp服务配置为可匿名登录,并且要把rpm包都放在ftp匿名登录的root目录下面。Vsftp匿名登录的配置为:
anonymous_enable=YES
anon_root=/share(这个为vsftp匿名登录的root目录,并且其属性不能为/etc/vsftp/ftpusers,/etc/vsftp/user_list文件中所配置的用户,否则不能匿名登录)
如果不配置匿名登录或者匿名登录root目录设置不对会出现如下错误:
[root@srcbdc yum.repos.d]# yum list
Loaded plugins: aliases, rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
ftp://yumserver/RHEL/Server/repodata/repomd.xml: [Errno 4] IOError: [Errno ftp error] 550 Failed to change directory.
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: RHEL-Server. Please verify its path and try again
2、    先检查yum是否已安装,如果没有安装可以从光盘里面安装
[root@srcbdc ~]# rpm -qa|grep yum
yum-security-1.1.16-13.el5
yum-rhn-plugin-0.5.4-13.el5
yum-metadata-parser-1.1.2-3.el5
yum-updatesd-0.9-2.el5
yum-aliases-1.1.16-13.el5
yum-3.2.22-20.el5
3、    安装另一个用于yum的包createrepo
[root@srcbdc Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing…                ########################################### [100%]
   1:createrepo             ########################################### [100%]
这个工具主要是用来生产yum所需要用到的安装包关系的数据库。
4、    把系统盘中的Server目录和VT目录拷贝到新的目录里面,我的是从ISO文件里面复制出来的
先挂载ISO文件
[root@srcbdc ~]# mount -o loop /instsvr/ISO/rhel-server-6.2-x86_64-dvd.iso /mnt
Copy文件
[root@srcbdc ~]# mkdir -p /instsvr/RHEL6.2/x64
[root@srcbdc ~]# cp -r /mnt/ /instsvr/RHEL6.2/x64
5、    创建rpm关系数据库
[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/Server/repodata/*comps-rhel6-Server.xml -o /instsvr/RHEL6.2/x64/Server -i /instsvr/RHEL6.2/x64/Server/listing /instsvr/RHEL6.2/x64/Packages/
[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/HighAvailability/repodata/*comps-rhel6-HighAvailability.xml -o /instsvr/RHEL6.2/x64/HighAvailability -i /instsvr/RHEL6.2/x64/HighAvailability/listing /instsvr/RHEL6.2/x64/Packages/
[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/LoadBalancer/repodata/*comps-rhel6-LoadBalancer.xml -o /instsvr/RHEL6.2/x64/LoadBalancer -i /instsvr/RHEL6.2/x64/LoadBalancer/listing /instsvr/RHEL6.2/x64/Packages/
[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/ResilientStorage/repodata/*comps-rhel6-ResilientStorage.xml -o /instsvr/RHEL6.2/x64/ResilientStorage -i /instsvr/RHEL6.2/x64/ResilientStorage/listing /instsvr/RHEL6.2/x64/Packages/
[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/ScalableFileSystem/repodata/*comps-rhel6-ScalableFileSystem.xml -o /instsvr/RHEL6.2/x64/ScalableFileSystem -i /instsvr/RHEL6.2/x64/ScalableFileSystem/listing /instsvr/RHEL6.2/x64/Packages/

创建rpm包的link文件:


[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/Server
[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done
[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/HighAvailability
[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done
[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/LoadBalancer
[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done
[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/ResilientStorage
[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done
[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/ScalableFileSystem
[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done



6、    清除yum缓存信息
[root@srcbdc yum.repos.d]# yum clean all
Loaded plugins: aliases, rhnplugin, security
Cleaning up Everything
7、    再使用yum list名称查看rpm包,正常的话会列出所有的rpm包


客户端:


客户端就比较好配置了,只需要在/etc/yum.d.repo/目录小添加本地yum源配置文件即可


[root@instsvr1 yum.repos.d]# cat rhel6.2-x64.repo
[RHEL6.2-Server-X64]
name=Red Hat Enterprise Linux Install Server
baseurl=ftp://192.168.220.46/RHEL6.2/x64/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
[RHEL6.2-HighAvailability-X64]
name=Red Hat Enterprise Linux Install Server
baseurl=ftp://192.168.220.46/RHEL6.2/x64/HighAvailability/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[RHEL6.2-LoadBalancer-X64]
name=Red Hat Enterprise Linux Install Server
baseurl=ftp://192.168.220.46/RHEL6.2/x64/LoadBalancer/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[RHEL6.2-ResilientStorage-X64]
name=Red Hat Enterprise Linux Install Server
baseurl=ftp://192.168.220.46/RHEL6.2/x64/ResilientStorage/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[RHEL6.2-ScalableFileSystem-X64]
name=Red Hat Enterprise Linux Install Server
baseurl=ftp://192.168.220.46/RHEL6.2/x64/ScalableFileSystem/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[RHEL-RPMS]
name=Red Hat Enterprise Linux Install Server
baseurl=ftp://192.168.220.46/rpms
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release




【网摘】
repodata 数据库介绍
repodata 数据库中的文件主要是 XML 格式,精确描述一个 rpm 包的详细信息,如依赖关系,包含文件,校验码信息。目前,这个格式被 apt-rpm,smartpm,red carpet 和 yum 支持。

通常有以下几个文件:
repomd.xml (md 意思是 metadata)
repomd.xml 是描述其他 metadata 文件的文件。相当于其他文件的索引。包含其他文件的时间戳和校验值(checksums)。这样客户端只要下载这一个文件(通常很小,几KB),就可以知道其他文件中哪些有“更新”。这也意味只,只要对这一个文件签名,就可以达到对其他文件签名的作用。
primary.xml.[gz]
这个文件存储主要的 metadata 信息,这些信息包括:




  • repomd.xml this is the file that describes the other metadata files. It is like an index file to point to the other files. It contains timestamps and checksums for the other files. This lets a client download this one, small file and know if anything else has changed. This also means that cryptographically (ex: gpg) signing this one file can ensure repository integrity.


  • primary.xml.[gz] this file stores the primary metadata information. This includes information such as:

    • name, epoch, version, release, architecture
    • file size, file location, description, summary, format, checksums header byte-ranges, etc.
    • dependencies, provides, conflicts, obsoletes, suggests, recommends
    • file lists for the package for CERTAIN files – specifically files matching: /etc*, *bin/*, /usr/lib/sendmail [1]

  • filelists.xml.[gz] this file stores the complete file and directory listings for the packages. The package is identified by: name, epoch, version, release, architecture and package checksum id.
  • other.xml.[gz] this file currently only stores the changelog data from packages. However, this file could be used for any other additional metadata that could be useful for clients.
  • groups.xml.[gz] this file is tentatively described. The intention is for a common package-groups specification as well. There is still some sections for this format that need to be fleshed out.

赞(0) 打赏
转载请注明出处:服务器评测 » 配置RHEL6.2的YUM源
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏