通过配置本地yum服务器,为本地的linux以及局域网中的linux操作系统安装软件。本文的服务配置环境为:redhat enterprise 5.10,软件来源:系统镜像文件(rhel-server-5.10-x86-64-dvd.iso)。本次实验均在VMware Workstation虚拟机中完成。

一、 服务端安装

首先查询一下服务端是否安装:
[root@localhost ~]# rpm -qa yum
yum-3.2.22-40.el5(本机已安装)如未安装则进行下面操作.

1.yum服务端应安装以下软件
yum-3.2.22-40.el5

createrepo-0.4.4-2.fc6.noarch.rpm

2.准备安装程序包

虚拟机-->设置-->CD/DVD-->使用ISO映像文件-->浏览-->找到镜像文件-->设备状态(已连接和启动时链接都要勾选)。

进目录查看一下(这是默认的挂载点)

[root@localhost ~]# cd /misc/cd
[root@localhost cd]# ls
Cluster            README-te.html             RELEASE-NOTES-U10-en.html
ClusterStorage 
    README-zh_CN.html          RELEASE-NOTES-U10-es.html
EULA               README-zh_TW.html          RELEASE-NOTES-U10-fr.html
eula.en_US         RELEASE-NOTES-as.html      RELEASE-NOTES-U10-gu.html
GPL                RELEASE-NOTES-bn.html      RELEASE-NOTES-U10-hi.html
images             RELEASE-NOTES-de.html      RELEASE-NOTES-U10-it.html
isolinux           RELEASE-NOTES-en           RELEASE-NOTES-U10-ja.html
README-as.html     RELEASE-NOTES-en.html      RELEASE-NOTES-U10-kn.html
README-bn.html     RELEASE-NOTES-es.html      RELEASE-NOTES-U10-ko.html
README-de.html     RELEASE-NOTES-fr.html      RELEASE-NOTES-U10-ml.html
README-en          RELEASE-NOTES-gu.html      RELEASE-NOTES-U10-mr.html
README-en.html     RELEASE-NOTES-hi.html      RELEASE-NOTES-U10-or.html
README-es.html     RELEASE-NOTES-it.html      RELEASE-NOTES-U10-pa.html
README-fr.html     RELEASE-NOTES-ja.html      RELEASE-NOTES-U10-pt_BR.html
README-gu.html     RELEASE-NOTES-kn.html      RELEASE-NOTES-U10-ru.html
README-hi.html     RELEASE-NOTES-ko.html      RELEASE-NOTES-U10-ta.html
README-it.html     RELEASE-NOTES-ml.html      RELEASE-NOTES-U10-te.html
README-ja.html     RELEASE-NOTES-mr.html      RELEASE-NOTES-U10-zh_CN.html
README-kn.html     RELEASE-NOTES-or.html      RELEASE-NOTES-U10-zh_TW.html
README-ko.html     RELEASE-NOTES-pa.html      RELEASE-NOTES-zh_CN.html
README-ml.html     RELEASE-NOTES-pt_BR.html   RELEASE-NOTES-zh_TW.html
README-mr.html     RELEASE-NOTES-ru.html      RPM-GPG-KEY-redhat-beta
README-or.html     RELEASE-NOTES-ta.html      RPM-GPG-KEY-redhat-release
README-pa.html     RELEASE-NOTES-te.html    
  Server(正常我们所用的软件包都在这)
README-pt_BR.html  RELEASE-NOTES-U10-as.html  TRANS.TBL
README-ru.html     RELEASE-NOTES-U10-bn.html  VT
README-si.html     RELEASE-NOTES-U10-de.html
README-ta.html     RELEASE-NOTES-U10-en
[root@localhost cd]#

配置yum文件

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

[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///misc/cd/Server/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

保存退出

 yum list | wc -l      查看一下

2556

五、客户端测试
yum clean all  /*清除旧的缓存数据*/


安装httpd测试一下

[root@localhost ~]# yum install httpd
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-82.el5_9 set to be updated
rhel-debuginfo/filelists                                 | 2.6 MB     00:00    
--> Processing Dependency: libapr-1.so.0 for package: httpd
--> Processing Dependency: libaprutil-1.so.0 for package: httpd
--> Running transaction check
---> Package apr.i386 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr-util.i386 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: libpq.so.4 for package: apr-util
--> Running transaction check
---> Package postgresql-libs.i386 0:8.1.23-6.el5_8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch      Version               Repository           Size
================================================================================
Installing:
 httpd                i386      2.2.3-82.el5_9        rhel-debuginfo      1.2 M
Installing for dependencies:
 apr                  i386      1.2.7-11.el5_6.5      rhel-debuginfo      124 k
 apr-util             i386      1.2.7-11.el5_5.2      rhel-debuginfo       80 k
 postgresql-libs      i386      8.1.23-6.el5_8        rhel-debuginfo      197 k

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

Total download size: 1.6 M
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           452 MB/s | 1.6 MB     00:00    
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186
rhel-debuginfo/gpgkey                                    | 1.1 kB     00:00    
Importing GPG key 0x37017186 "Red Hat, Inc. (release key) <security@redhat.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : apr                                                      1/4
  Installing     : postgresql-libs                                          2/4
  Installing     : apr-util                                                 3/4
  Installing     : httpd                                                    4/4
rhel-debuginfo/productid                                 | 1.7 kB     00:00    

Installed:
  httpd.i386 0:2.2.3-82.el5_9                                                  

Dependency Installed:
  apr.i386 0:1.2.7-11.el5_6.5               apr-util.i386 0:1.2.7-11.el5_5.2   
  postgresql-libs.i386 0:8.1.23-6.el5_8   

Complete!

 配置yum库主要为了解决依赖关系这个麻烦事。