参考文档链接:http://hx100.blog.51cto.com/44326/366242

环境

操作系统

Linux XXX 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64x86_64 x86_64 GNU/Linux

其中

ftp yum源:        192.168.8.22

yum客户端:     192.168.8.23

 

1.       ftp yum源配置(在192.168.8.22上配置)

如果做成ftp源供他的服务器使用的话,按照下面步骤
 Red Hat 所分发的软件,其中已经针对光盘介质做好了软件包的依赖关系,重新移动位置后,我们需要重新创建这个关系,操作起来并不复杂,因为它集成了相关的文件,我们只需参数文件来创建即可,说的那么复杂,其实所有的动作都是电脑完成,我们只需要打一条命令即可

如果你是RHEL5.1的系统,那么你在每创建一个库时,它就会产生一个错误,以我这个例子来说,应该是已经存在/var/ftp/pub/repo/Server/.olddata这个目录,只要将其删除再重新创建一下就可以了,这个问题在RHEL5.1之后的版本不会出现了。

 

[root@XXX Server]# cd /yum/

[root@XXX yum]# mv * /var/ftp/pub/

 

跳转到根目录下再执行创建命令

创建的链接目录必须都在/var/ftp/pub/Server/

[root@XXX /]#createrepo -g /var/ftp/pub/Server/repodata_bak/comps-rhel5-server-core.xml  /var/ftp/pub/Server/ 

3284/3284 - gpm-1.20.1-74.1.i386.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

 

创建的链接目录必须都在/var/ftp/pub/VT/

[root@XXX /]#createrepo-g /var/ftp/pub/VT/repodata_bak/comps-rhel5-vt.xml   /var/ftp/pub/VT/

58/58 - Virtualization-ml-IN-5.8-1.el5.noarch.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

 

创建的链接目录必须都在/var/ftp/pub/Cluster/

[root@XXX /]#createrepo -g /var/ftp/pub/Cluster/repodata_bak/comps-rhel5-cluster.xml   /var/ftp/pub/Cluster/

32/32 - Cluster_Administration-mr-IN-5.8-1.el5.noarch.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

 

创建的链接目录必须都在/var/ftp/pub/ClusterStorage/

#createrepo-g /var/ftp/pub/ClusterStorage/repodata_bak/comps-rhel5-cluster-st.xml  /var/ftp/pub/ClusterStorage/

39/39 - gfs-utils-0.1.20-13.el5.x86_64.rpm                                     

Saving Primary metadata

Saving file lists metadata

Saving othermetadata

 

[root@XXX /]# cd /etc/yum.repos.d/

[root@XXX yum.repos.d]# vi ftpyum.repo

 

[base]

name=Server

baseurl=ftp://192.168.8.22/pub/Server  #为相对路径,相对/var/ftp/

enabled=1

gpgcheck=0

 

[VT]

name=VT

baseurl=ftp://192.168.8.22/pub/VT

enabled=1

gpgcheck=0

 

[Cluster]

name=Cluster

baseurl=ftp://192.168.8.22/pub/Cluster

enabled=1

gpgcheck=0

 

[CS]

name=ClusterStorage

baseurl=ftp://192.168.8.22/pub/ClusterStorage

enabled=1

gpgcheck=0

 

2.       客户端配置

ftp yum源的repo文件拷贝到客户端:192.168.8.23即可

3.       测试

ftp yum 源

yum源配好后,在ftp 源端进行测试

[root@XXX~]# yum install samba

Loadedplugins: katello, product-id, security, subscription-manager

Updatingcertificate-based repositories.

Unable toread consumer identity

CS                | 1.1 kB     00:00    

CS/primary            | 8.7 kB     00:00    

CS                    39/39

Cluster               | 1.1 kB     00:00    

Cluster/primary        | 5.9 kB    00:00    

Cluster                32/32

VT                   | 1.1 kB     00:00    

VT/primary            | 20 kB     00:00    

VT                    58/58

base                  | 1.1 kB     00:00    

base/primary           | 1.1 MB     00:00    

base                  3284/3284

Settingup Install Process

ResolvingDependencies

-->Running transaction check

--->Package samba.x86_64 0:3.0.33-3.37.el5 set to be updated

-->Processing Dependency: perl(Convert::ASN1) for package: samba

-->Running transaction check

--->Package perl-Convert-ASN1.noarch 0:0.20-1.1 set to be updated

-->Finished Dependency Resolution

 

DependenciesResolved

………………

Totaldownload size: 16 M

Is thisok [y/N]: y

DownloadingPackages:

(1/2):perl-Convert-ASN1-0.20-1.1.noarch.rpm                            |  41 kB    00:00    

(2/2):samba-3.0.33-3.37.el5.x86_64.rpm                                          |  16 MB    00:00    

---------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                  58 MB/s |  16 MB     00:00    

Runningrpm_check_debug

RunningTransaction Test

FinishedTransaction Test

TransactionTest Succeeded

RunningTransaction

  Installing:perl-Convert-ASN1                                          1/2

  Installing:samba                                                                                                        2/2

Installedproducts updated.

Installed:

  samba.x86_64 0:3.0.33-3.37.el5                                                                                                                                       

DependencyInstalled:

  perl-Convert-ASN1.noarch 0:0.20-1.1                                                                                                                                 

Complete!

客户端配置

ftp yum源将repo文件拷贝到客户端192.168.8.23,客户端就可以用yum来安装需要的软件包了

Logo

更多推荐