前提:

1)www或者ftp且可以访问

2)createrepo更新YUM数据库

 

如何配置yum源? 

[root@szm Downloads]# cd /media/CentOS_6.0_Final/repodata/

 

[root@szm repodata]# ls

2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2

509e08f6113733097d575739730e47783b85f94fe8cf449767364b8b8c7aba7b-other.xml.gz
-----包含每一个RPM包的附加信息,如修改日志

如何搭建本地yum源。67e74ebb80b8882defa7712a4a7192a65bd68d33894f6013fca41f4954845aa1-c6-i386-comps.xml.gz
-----包含软件仓库内RPM包的信息

73a3b7e0741eba6cafa8d5404b02565060e7f2293caab10657074186c48e713b-c6-i386-comps.xml
-----记录目录内所有软件包的分组信息。

b4ccc345fa1c924fa1ab3841913be2c37507dc448b91f33f95e041c00b4bacfa-filelists.xml.gz

bc37813e8d9a5dd92784ba8149dc2995db7be4624207d56fe841bbf14187180f-primary.xml.gz

c639bc18e11e6e620b30b80fa43f69d830c08a1c1890b0dc5afed0028704ddc8-other.sqlite.bz2

d15a7119737517aa5f5a330d9da13336e537845f861a9757e0d211249e193836-filelists.sqlite.bz2

如何配置本地yum源、repomd.xml-----记录着其他三个文件的时间戳,一量客户端与服务器建立连接之后,它将缓存所有文件;如果软件仓库的信息发生变化之后,才会更新缓存信息。

TRANS.TBL

[root@szm repodata]# createrepo -h
Usage: genpkgmetadata.py [options]
Options:
--version             show program's version number and exit
-h, --help            show this help message and exit
-q, --quiet           output nothing except for serious errors
  -v, --verbose         output more debugging info.----显示数据库的更新过程
--profile             output timing/profile info.
-x EXCLUDES, --excludes=EXCLUDES
files to exclude
--basedir=BASEDIR     basedir for path to directories
-u BASEURL, --baseurl=BASEURL
baseurl to append on all files
  -g GROUPFILE, --groupfile=GROUPFILE------为仓库内的软件包建立分组信息
path to groupfile to include in metadata
-s SUMTYPE, --checksum=SUMTYPE
specify the checksum type to use (default: sha256)
-p, --pretty          make sure all xml generated is formatted
-c CACHEDIR, --cachedir=CACHEDIR
set path to cache dir
-C, --checkts         check timestamps on files vs the metadata to see if we
need to update
-d, --database        create sqlite database files: now default, see --no-
database to disable
--no-database         do not create sqlite dbs of metadata
--update              use the existing repodata to speed up creation of new
--update-md-path=UPDATE_MD_PATH
use the existing repodata  for --update from this path
--skip-stat           skip the stat() call on a --update, assumes if the
filename is the same then the file is still the same
(only use this if you're fairly trusting or gullible)
--split               generate split media
-i PKGLIST, --pkglist=PKGLIST
use only the files listed in this file from the
directory specified
-n INCLUDEPKG, --includepkg=INCLUDEPKG
add this pkg to the list - can be specified multiple
times
-o OUTPUTDIR, --outputdir=OUTPUTDIR
<dir> = optional directory to output to
-S, --skip-symlinks   ignore symlinks of packages
--changelog-limit=CHANGELOG_LIMIT
only import the last N changelog entries
--unique-md-filenames
include the file's checksum in the filename, helps
with proxies
--simple-md-filenames
do not include the file's checksum in the filename,
helps with proxies
--retain-old-md=RETAIN_OLD_MD
keep around the latest (by timestamp) N copies of the
old repodata
--distro=DISTRO       distro tag and optional cpeid:
--distro'cpeid,textname'
--content=CONTENT_TAGS
tags for the content in the repository
--repo=REPO_TAGS      tags to describe the repository itself
--revision=REVISION   user-specified revision for this repository
--deltas              create delta rpms and metadata
--oldpackagedirs=OLDPACKAGE_PATHS
paths to look for older pkgs to delta against
--num-deltas=NUM_DELTAS
the number of older versions to make deltas against
--read-pkgs-list=READ_PKGS_LIST
output the paths to the pkgs actually read useful with
--update
--max-delta-rpm-size=MAX_DELTA_RPM_SIZE
max size of an rpm that to run deltarpm against (in
bytes)
--workers=WORKERS     number of workers to spawn to read rpms
--xz                  use xz for repodata compression
--compress-type=COMPRESS_TYPE
which compression type to use
复制光盘到:/var/www/html目录内。
生成数据库信息:[root@szm ~]# createrepo -g /media/CentOS_6.0_Final/repodata/67e74ebb80b8882defa7712a4a7192a65bd68d33894f6013fca41f4954845aa1-c6-i386-comps.xml.gz .
配置repo文件即可;