RHEL5架设本地yum源

来源:互联网 发布:淘宝客服工作总结 编辑:程序博客网 时间:2024/04/29 09:54

前言:本文并非全部原创,主要转自

http://hi.baidu.com/xi4oyu/blog/item/7be97726c2066604908f9dbe.html

还参考了其他的一些文章,在配置yum源服务端的过程中没有问题,但我在配置yum客户端时,即配置/etc/yum.repos.d/rhel5-rpms-from-lansvr.repo时如果使用文章的配置则会提示"不能获得软件包信息--这可能是由没有可用的网络连接引起的。"原因可能是我的FTP帐户没有配置好,我在最后会附上我的本地文件系统rhel5-rpms-from-lansvr.repo的配置。


    主要是为了方便做实验,在安装依赖关系较复杂的软件时,能够自动分析依赖关系,安装需要的软件,比较省事。
###########################################################################################
系统环境:
    Red Hat Enterprise Linux Server release 5
软件环境:
    vsftpd-2.0.5-10.el5
    createrepo-0.4.4-2.fc6
    yum-3.0.1-5.el5
###########################################################################################
一、配置yum源服务端(192.168.4.1)
    1、从RHEL5 DVD光盘中复制软件包。
[root@localhost ~]# mount /dev/cdrom /media/cdrom
[root@localhost ~]# cp -prf /media/cdrom /var/ftp/rhel5
[root@localhost ~]# umount /dev/cdrom

    2、安装createrepo软件包。
[root@localhost ~]# rpm -ivh /var/ftp/rhel5/Server/createrepo-0.4.4-2.fc6.noarch.rpm

    3、重新创建repository信息库。
[root@localhost ~]# cd /var/ftp/rhel5/Server/
[root@localhost Server]# createrepo -g repodata/comps-rhel5-server-core.xml ./

[root@localhost Server]# cd ../Cluster/
[root@localhost Cluster]# createrepo -g repodata/comps-rhel5-cluster.xml ./

[root@localhost Cluster]# cd ../ClusterStorage
[root@localhost ClusterStorage]# createrepo -g repodata/comps-rhel5-cluster-st.xml ./

[root@localhost ClusterStorage]# cd ../VT
[root@localhost VT]# createrepo -g repodata/comps-rhel5-vt.xml ./

[root@localhost VT]# rm -rf ../*/.olddata/

    4、启动vsftpd服务(按默认配置即可)。
[root@localhost ~]# /etc/init.d/vsftpd start


二、客户端测试

    1、创建.repo配置文件。
[root@localhost ~]# vi /etc/yum.repos.d/rhel5-rpms-from-lansvr.repo
[Cluster]
name=Cluster Directory
baseurl=ftp://192.168.4.1/rhel5/Cluster
enabled=1
gpgcheck=0

[ClusterStorage]
name=ClusterStorage Directory
baseurl=ftp://192.168.4.1/rhel5/ClusterStorage
enabled=1
gpgcheck=0

[Server]
name=Server Directory
baseurl=ftp://192.168.4.1/rhel5/Server
enabled=1
gpgcheck=0

[VT]
name=VT Directory
baseurl=ftp://192.168.4.1/rhel5/VT
enabled=1
gpgcheck=0

    2、清除旧的缓存数据。
[root@localhost ~]# yum clean all

    3、软件安装测试
        1)能够使用yum下载安装软件。
    例如,使用以下命令会下载安装bind、bind-chroot软件包(自动查找解决依赖关系):
[root@localhost ~]# yum install bind-chroot
        2)使用system-config-packages“添加删除程序”(在X-Window环境)。
            应该能够浏览并安装集群、集群存储、虚拟化……等各项软件包。……

 

 

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

附我的配置:

[Cluster]
name=Cluster Directory
baseurl=file:///var/ftp/rhel5/Cluster
enabled=1
gpgcheck=0

[ClusterStorage]
name=ClusterStorage Directory
baseurl=file:///var/ftp/rhel5/ClusterStorage
enabled=1
gpgcheck=0

[Server]
name=Server Directory
baseurl=file:///var/ftp/rhel5/Server
enabled=1
gpgcheck=0

[VT]
name=VT Directory
baseurl=file:///var/ftp/rhel5/VT
enabled=1
gpgcheck=0