RHEL5配置本地yum源

 

挂载镜像:

[root@localhost /]# mount /dev/cdrom 或者mount -o loop *.iso /mnt/cdrom

[root@localhost /]# cp -rf /mnt/* /iso

修改yum配置文件

[root@localhost /]# vi /etc/yum.repos.d/rhel-debuginfo.repo

[Server]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=file:///iso/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Cluster]

name=Red Hat Enterprise Linux $releasever - $basearch - Cluster

baseurl= file:///iso/Cluster

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]

name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage

baseurl= file:///iso/ClusterStorage

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Server]

name=Red Hat Enterprise Linux $releasever - $basearch - Server

baseurl= file:///iso/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]

name=Red Hat Enterprise Linux $releasever - $basearch - VT

baseurl= file:///iso/VT

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

参数注释:

[....] 代表这个库的名字,必须是唯一的,不可以重复。

name= 是这个库的说明,没有太大的实际意义,只是一个字段说明。

baseurl= 说明采取传输方式,可以使用的方式有,file://,ftp://,http://,nfs://等

enabled=1 说明启用这个更新库,0表示不启用。

gpgcheck=1 表示使用gpg文件来检查软件包的签名,注gpgcheck设置为0,则不需要认证签名

gpgkey= 表示gpg文件所存放的位置。(切记本地key文件)

注:理论上来说直接设置Server即可,但要完善的更新所有的rpm

rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm

[root@localhost iso]# createrepo --update –g . 更新本地源

[root@localhost iso]#createrepo . 重新生成metadata .

(后接yum更新文件的路径,这里是“.”表示当前目录)

注:执行createrepo更新或者重新生成如下文件

/iso/Server/repodata/comps-rhel5-server-core.xml

/iso/VT/repodata/comps-rhel5-vt.xml

/iso/Cluster/repodata/comps-rhel5-cluster.xml

/iso/ClusterStorage/repodata/comps-rhel5-cluster-st.xml

此些文件重新产生元数据,重新生成安装包的相互依赖关系

问题汇总

Cluster 100% |=========================| 1.3 kB 00:00

ClusterStorage 100% |=========================| 1.3 kB 00:00

VT 100% |=========================| 1.3 kB 00:00

Server 100% |=========================| 1.3 kB 00:00

Reading repository metadata in from local files

primary.xml.gz 100% |=========================| 6.2 kB 00:00

################################################## 32/32

primary.xml.gz 100% |=========================| 7.9 kB 00:00

################################################## 36/36

primary.xml.gz 100% |=========================| 9.7 kB 00:00

################################################## 31/31

primary.xml.gz 100% |=========================| 686 kB 00:00

################################################## 2159/2159

Parsing package install arguments

Resolving Dependencies

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for vsftpd to pack into transaction set.

media://1192656534.547140%232/vsftpd-2.0.5-10.el5.i386.rpm: [Errno 4] IOError:

Trying other mirror.

Error: failed to retrieve vsftpd-2.0.5-10.el5.i386.rpm from Server

error was [Errno 4] IOError:

解决办法:安装并执行createrepo

你可能感兴趣的:(RHEL5配置本地yum源)