• 环境

Server:192.168.1.11  yum.test.com  CentOS 5

Client: 192.168.1.21  


  • Server端:

安装必备软件

yum install httpd  createrepo

启动Web Server

service httpd start

准备RPM源文件

mkdir -p /var/www/html/os
mount /dev/cdrom /media
cp -rf /media /var/www/html/os
cd /media /var/www/html/os


   wget http://downloads.sourceforge.net/project/zenoss/zenoss-3.1.0.el4.i386.rpm下载一个第三方的rpm包来测试

创建repo文件

 

createrepo -d -p  /var/www/html/os

会在 /var/www/html/os下生成一个子目录 repodata,内容如下

`-- os
   |-- repodata
   |   |-- filelists.sqlite.bz2
   |   |-- filelists.xml.gz
   |   |-- other.sqlite.bz2
   |   |-- other.xml.gz
   |   |-- primary.sqlite.bz2
   |   |-- primary.xml.gz
   |   `-- repomd.xml
   `-- zenoss-3.1.0.el4.i386.rpm


  • client端

根据情况备份或删除原有repo文件

rm -f /etc/yum.repo.d/*
vi /etc/yum.repo.d/test.repo


[test]
name=yumsite
baseurl=http://yum.test.com/os
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5


更新Yum源

#yum clean all

# yum info zenoss  
Loaded plugins: fastestmirror
Determining fastest mirrors
test                                                                 | 1.9 kB     00:00
test/primary_db                                                      | 1.9 MB     00:00
Available Packages
Name       : zenoss
Arch       : i386
Version    : 3.1.0
Release    : 1031.el4
Size       : 63 M
Repo       : test
Summary    : The Open Source Network Management System
URL        : http://www.zenoss.com/
License    : GPLv2
Description: Zenoss is an IT infrastructure monitoring product that allows you to
          : monitor your entire infrastructure within a single, integrated
          : software application.
          :
          : Key features include:
          :   * Monitors the entire stack
          :     o networks, servers, applications, services, power, environment, etc...
          :   * Monitors across all perspectives
          :     o discovery, configuration, availability, performance, events, alerts, etc.
          :   * Affordable and easy to use
          :     o unlike the big suites offered by IBM, HP, BMC, CA, etc...
          :     o unlike first generation open source tools...
          :   * Complete open source package
          :     o complete solution available as free, open source software