yum 是专门用于管理rpm包的工具。yum源是用于存放rpm包的仓库。
安装createrepo
制作yum源需要createrepo工具,首先安装工具:
# yum install createrepo
创建repo
[lanyang@localhost rpmbuild]$ createrepo RPMS/
Spawning worker 0 with 2 pkgs
Workers Finished
Gathering worker results
Saving Primary Metadata
Saving file lists Metadata
Saving other Metadata
Generating sqlite DBs
sqlite DBs complete
[lanyang@localhost rpmbuild] ll RPMS/
total 8
drwxrwxr-x 2 lanyang lanyang 4096 Sep 22 15:34 repodata
drwxr-xr-x 2 lanyang lanyang 4096 Sep 21 14:01 x86_64
[zhangyunyang@monitor-test-centos rpmbuild]$ ll RPMS/repodata/
total 28
-rw-rw-r-- 1 lanyang lanyang 392 Sep 22 15:34 0f58148dbe8464d5c11afb1951108359cccd62f31b29adcafe3733c8f5fa6472-filelists.xml.gz -rw-rw-r-- 1 lanyang lanyang 725 Sep 22 15:34 3bd6b25faae289ba195e58c354459425b8b850fbe01d7df4bb983be828f5ecd2-other.sqlite.bz2 -rw-rw-r-- 1 lanyang lanyang 1047 Sep 22 15:34 465418f89d1409d6b3185c1d64baf7143c61b28e1ecb83e4a26c41f7b2814bde-filelists.sqlite.bz2 -rw-rw-r-- 1 lanyang lanyang 2279 Sep 22 15:34 512b51cc4de2221f0b9f1ca81378806272233ff1e422e41490e206f02990ffee-primary.sqlite.bz2 -rw-rw-r-- 1 lanyang lanyang 832 Sep 22 15:34 d315b1b67f44055bc5c051f90a5fddb37442eebdb4c2115e8cbcfa12c43b0dfd-primary.xml.gz -rw-rw-r-- 1 lanyang lanyang 298 Sep 22 15:34 f6cd566e5b1e60910422d81a5bd6f3a0f6af8c8049ba5afe673c02ec27acf49d-other.xml.gz
搭建yum源服务器
# cd RPMS
# python -m SimpleHTTPServer 8082
Serving HTTP on 0.0.0.0 port 8082 ...
通过浏览器查看,可以看到目录和文件列表:
测试
下面对制作的yum源进行测试。
配置yum源
/etc/yum.repos.d目录下创建文件agent.repo,内容为:
[orange-agent]
name=orange-agent repo
baseurl=http://192.168.33.152:8082/
gpgcheck=0
enabled=1
安装rpm包
配置好yum源后,接着进行包的安装。
$ yum install orange-plus
成功安装。
参考
yum源制作
http://www.linuxidc.com/Linux/2010-10/29134.htm