原来RHEL5上配置本地YUM源的方法在RHEL6已经不适用了,新的配置方法如下:

创建源文件存放的目录

#mkdir /yum/

加载光盘

#mount /dev/cdrom /media

将光盘文件复制到服务器上的源目录

#cp -a /media/* /yum/

新建一个yum源的响应文件

# vi /etc/yum.repos.d/local.repo

 内容如下:

[base]
name=linux 6
baseurl=file:///yum
gpgcheck=0
enable=1

修改yum源的地址

# vi /usr/lib/python2.6/site-packages/yum/yumRepo.py

 在上面的文件中找到下面这行

 remote = url + '/' + relative

将其改为

 remote + '/yum' + relative

配置到这里就完成了,安装个软件做下测试

[root@rhel6-a yum]# yum install samba
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
base                                                      | 3.7 kB     00:00 ...
base/primary_db                                           | 2.3 MB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.i686 0:3.5.4-68.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================
 Package          Arch            Version                  Repository       Size
=================================================================================
Installing:
 samba            i686            3.5.4-68.el6             base            5.0 M

Transaction Summary
=================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 5.0 M
Installed size: 17 M
Is this ok [y/N]:

大功告成。

当然还可以通过上述方法配置ftp和http的yum源。

转载请注明:

本文转自:http://www.liusuping.com/ubuntu-linux/rhel6-local-yum.html