注: YUM是红帽5以后官方推荐的装包方式,能自动解决包之间的依赖关系,常用的方式有两种:本地YUM和基于FTP的YUM.

1、挂载光盘
[root@localhost ~]# mount -o loop /dev/cdrom /media
[root@localhost ~]# 

2、配置YUM的主配置文件vim /etc/yum.repos.d/rhel-debuginfo.repo 
[server]
name=server
baseurl=file:///media/Server
enabled=1
gpgcheck=0

3、[root@localhost ~]# yum grouplist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
server                                                   | 1.3 kB     00:00     
Installed Groups:
   GNOME 桌面环境
   Windows 文件服务器
   X 窗口系统
   办公/生产率
   图形
   图形化互联网
   基于文本的互联网
   打印支持
   服务器配置工具
   游戏和娱乐
   管理工具
   系统工具
   编辑器
   网络服务器
   老的网络服务器
   老的软件开发
   老的软件支持
   视频和音频
   邮件服务器
Available Groups:
   DNS 名称服务器
   FTP 服务器
   GNOME 软件开发
   Java开发
   KDE 软件开发
   KDE (K 桌面环境)
   MySQL 数据库
   OpenFabrics 企业版发行
   PostgreSQL 数据库
   X 软件开发
   万维网服务器
   工程和科学
   开发工具
   开发库
   授权和出版
   新闻服务器
Done
[root@localhost ~]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything

4、进行测试
[root@localhost /]# yum -y install samba
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
server                                                   | 1.3 kB     00:00     
server/primary                                           | 753 kB     00:00     
server                                                                2348/2348
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.i386 0:3.0.33-3.28.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

Dependencies Resolved

================================================================================
 Package                 Arch         Version                Repository    Size
================================================================================
Installing:
 samba                   i386         3.0.33-3.28.el5        server        16 M
Installing for dependencies:
 perl-Convert-ASN1       noarch       0.20-1.1               server        41 k

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

Total download size: 16 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           4.4 GB/s |  16 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-Convert-ASN1                                        1/2 
error: failed to stat /media/RHEL_5.5 i386 DVD: 没有那个文件或目录
  Installing     : samba                                                    2/2 

Installed:
  samba.i386 0:3.0.33-3.28.el5                                                  

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

Complete!