大家都知道RHN官方是收费的, RHEL6本地的YUM源。,其实在网上有很多yum的资料,但是都并不是我想要的,废话不多说了,直接用最简单的方法去做事情。

 
如下yum配置所示:
 
1:新建一个目录tony,将光盘的所有内容复制到tony目录。
[root@tony /]# mkdir tony
[root@tony /]# cp  -a /media/RHEL_6.0\ i386\ Disc\ 1/* /tony
2:在rhel6中/etc/yum.repos.d/下没有.repo文件,需要手工新建一个repo文件。
[root@tony /]# vi /etc/yum.repos.d/tony.repo 
编辑文件:
[tony]
 
name=tony
baseurl=file:///tony/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release (这个gpgcheck必须有)
 
3:接下来就可以使用yum安装、删除安装包了。
 yum install     软件名    安装软件
yum clean all                  清除缓存
yum remove   软件名    移除软件
 
4:安装dhcp软件包,如下所示:
[root@tony /]# yum install dhcp
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
tony                                                     | 3.7 kB     00:00 ... 
tony/primary_db                                          | 2.3 MB     00:00 ... 
Setting up Install Process
Package 12:dhcp-4.1.1-12.P1.el6.i686 already installed and latest version
Nothing to do
[root@tony /]# yum clean all
Loaded plugins: refresh-packagekit, rhnplugin
Cleaning up Everything
[root@tony /]# yum remove dhcp
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package dhcp.i686 12:4.1.1-12.P1.el6 set to be erased
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================
 
==
 Package       Arch          Version                       Repository      Size
==============================================================================
 
==
Removing:
 dhcp          i686          12:4.1.1-12.P1.el6            @epel          2.1 M
 
Transaction Summary
==============================================================================
 
==
Remove        1 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)
 
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : 12:dhcp-4.1.1-12.P1.el6.i686                             1/1 
 
Removed:
  dhcp.i686 12:4.1.1-12.P1.el6                                                  
 
Complete!
[root@tony /]# 
[root@tony /]# yum install dhcp
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dhcp.i686 12:4.1.1-12.P1.el6 set to be updated
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================
 
==
 Package       Arch          Version                        Repository     Size
==============================================================================
 
==
Installing:
 dhcp          i686          12:4.1.1-12.P1.el6             tony          868 k
 
Transaction Summary
==============================================================================
 
==
Install       1 Package(s)
Upgrade       0 Package(s)
 
Total download size: 868 k
Installed size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : 12:dhcp-4.1.1-12.P1.el6.i686                             1/1 
 
Installed:
  dhcp.i686 12:4.1.1-12.P1.el6                                                  
 
Complete!
 
接下来就查看是否安装上dhcp软件,
 
[root@tony /]# rpm -qa dhcp
dhcp-4.1.1-12.P1.el6.i686
 
ok!本次技术共享就到此结束,希望广大网友能给予本人支持。