repomd.xml:
this is the file that describes the other metadata files. It is like an index file to point to the other files. It contains timestamps and checksums for the other files. This lets a client download this one, small file and know if anything else has changed. This also means that cryptographically (ex: gpg) signing this one file can ensure repository integrity.
不用多言,看到 xml 的內(nèi)容,就已經(jīng)明白了它存儲(chǔ)了 rpm 包的哪些信息。
其它三個(gè)文件 filelists.xml.[gz]
this file stores the complete file and directory listings for the packages. The package is identified by: name, epoch, version, release, architecture and package checksum id.
看下內(nèi)容:
this file currently only stores the changelog data from packages. However, this file could be used for any other additional metadata that could be useful for clients.
看下內(nèi)容:
CREATE TRIGGER removals AFTER DELETE ON packages BEGIN DELETE FROM files WHERE pkgKey = old.pkgKey; DELETE FROM requires WHERE pkgKey = old.pkgKey; DELETE FROM provides WHERE pkgKey = old.pkgKey; DELETE FROM conflicts WHERE pkgKey = old.pkgKey; DELETE FROM obsoletes WHERE pkgKey = old.pkgKey; END;
sqlite> select * from packages;
1|6a6fbc7e58160ffa71b1f91912dc6eaf1cd6e0ae|wget|i386|1.14|0|1|GNU wget|The GNU wget program downloads files from the Internet using the command-line.||1357187570|1357185960|GPL||Development/Tools|yum.test.com|wget-1.14-1.src.rpm|280|9282||809949|2032999|2039664|wget-1.14-1.i386.rpm||sha|6a6fbc7e58160ffa71b1f91912dc6eaf1cd6e0ae
2|a9f4ad3086dcfcced210361bc72e4d418144cfcc|test-daddy|i386|1.1|0|1|GNU test-daddy|The GNU wget program downloads files from the Internet using the command-line.||1357187570|1357185424|GPL||Development/Tools|yum.test.com|test-daddy-1.1-1.src.rpm|280|2127||4235|9354|4936|test-daddy-1.1-1.i386.rpm||sha|a9f4ad3086dcfcced210361bc72e4d418144cfcc
3|82828b38c988399f597cceb14d896de6d36cd1c8|test-girl|i386|1.1|0|1|GNU test-girl|The GNU wget program downloads files from the Internet using the command-line.||1357187570|1357185262|GPL||Development/Tools|yum.test.com|test-girl-1.1-1.src.rpm|280|2119||4227|9354|4936|test-girl-1.1-1.i386.rpm||sha|82828b38c988399f597cceb14d896de6d36cd1c8
4|6ce87802e577736bb8b481c157cb9fb8822f8b88|wget-debuginfo|i386|1.14|0|1|Debug information for package wget|This package provides debug information for package wget.
Debug information is useful when developing applications that use this
package or when debugging this package.||1357187570|1357185960|GPL||Development/Debug|yum.test.com|wget-1.14-1.src.rpm|280|2043||19714|45564|45836|wget-debuginfo-1.14-1.i386.rpm||sha|6ce87802e577736bb8b481c157cb9fb8822f8b88
5|f377c921e23ba10507de267b345d03d1f32f02a4|test-baby|i386|1.1|0|1|GNU test-baby|The GNU wget program downloads files from the Internet using the command-line.||1356570667|1356570667|GPL||Development/Tools|localhost.localdomain|test-baby-1.1-1.src.rpm|280|2290||4463|9395|5108|test-baby-1.1-1.i386.rpm||sha|f377c921e23ba10507de267b345d03d1f32f02a4
sqlite>
來修改,這樣,yum 會(huì)加載這多個(gè)目錄下的*.repo 文件,在加載完這些之后,還要和 /etc/yum.conf 中的 repo 配置項(xiàng)合并,我們能夠看到 /etc/yum.conf 中最后一行有提示:
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
也就是在告訴使用者:你直接把 *.repo 中的內(nèi)容寫在這里也好。這樣,yum.conf 中的repo 最終會(huì)和 reposdir 中配置的 repo 合并。
從個(gè)人喜好角度講:我更喜歡把*.repo分開,不同的應(yīng)用不同的repo,也方便各自修改,更新,如果都合并到一個(gè)文件 yum.conf 中,更新修改都是這個(gè)文件,涉及到多個(gè)程序修改repo時(shí),還得進(jìn)行互斥操作,比較麻煩。另外,看起來格式也比較亂。
可以看到,一個(gè)文件是由一個(gè)或者若干個(gè) reposity 組成的,每個(gè) reposity 保持了傳統(tǒng)的 ini 文件的定義格式。
每個(gè)reposity 至少包含以下信息:
[repositoryid]
name=Some name for this repository
baseurl=url://path/to/repository/
復(fù)制代碼
reposityid 必須是一個(gè)唯一的單詞,也就是說是一個(gè)單詞,不能有空格隔開。
name:對(duì)這個(gè)repo的描述
baseurl 是訪問時(shí)的http地址模版,之所以叫模版,因?yàn)榻M成這個(gè) url 可以是一個(gè)實(shí)際的地址,也可以是變量組成的一個(gè)URL。
這里要注意一點(diǎn),baseurl 的域名都容易理解,是 yum 服務(wù)器的域名,然后后面的目錄路徑寫到什么地步呢?看下文檔原文: baseurl Must be a URL to the directory where the yum repository's 'repodata' directory lives. Can be an http://, ftp:// or file:// URL
對(duì)了,baseurl 就是要寫到包含索引目錄(repodata)那一層目錄為止,這樣yum 才能根據(jù)既定的協(xié)議去這個(gè)路徑下找 repodata 目錄,找對(duì)應(yīng)的 repomd.xml 文件,否則會(huì)報(bào)錯(cuò)。
可以采用 http/ftp/file 協(xié)議進(jìn)行訪問。
gpgcakey A URL pointing to the ASCII-armored CA key file for the repository. This is a normal gpg public key - but this key will be used to validate detached signatures of all other keys. The idea is you are asked to confirm import for this key. After that any other gpg key needed for package or repository verification, if it has a detached signature which matches this key will be automatically imported without user confirmation.
exclude Same as the [main] exclude option but only for this repository. Substitution variables, described below, are honored here.
includepkgs Inverse of exclude. This is a list of packages you want to use from a repository. If this option lists only one package then that is all yum will ever see from the repository. Defaults to an empty list. Substitution variables, described below, are honored here.
enablegroups Either '0' or '1'. Determines whether yum will allow the use of package groups for this repository. Default is '1' (package groups are allowed).
failovermethod Either 'roundrobin' or 'priority'.
'roundrobin' randomly selects a URL out of the list of URLs to start with and proceeds through each of them as it encounters a failure contacting the host.
'priority' starts from the first baseurl listed and reads through them sequentially.
failovermethod defaults to 'roundrobin' if not specified.
keepalive Either '1' or '0'. This tells yum whether or not HTTP/1.1 keepalive should be used with this repository. See the global option in the [main] section above for more information.
timeout Overrides the timeout option from the [main] section for this repository.
http_caching Overrides the http_caching option from the [main] section for this repository.
retries Overrides the retries option from the [main] section for this repository.
throttle Overrides the throttle option from the [main] section for this repository.
bandwidth Overrides the bandwidth option from the [main] section for this repository.
sslcacert Overrides the sslcacert option from the [main] section for this repository.
sslverify Overrides the sslverify option from the [main] section for this repository.
sslclientcert Overrides the sslclientcert option from the [main] section for this repository.
sslclientkey Overrides the sslclientkey option from the [main] section for this repository.
metadata_expire Overrides the metadata_expire option from the [main] section for this repository.
mirrorlist_expire Overrides the mirrorlist_expire option from the [main] section for this repository.
proxy URL to the proxy server for this repository. Set to '_none_' to disable the global proxy setting for this repository. If this is unset it inherits it from the global setting
proxy_username username to use for proxy. If this is unset it inherits it from the global setting
proxy_password password for this proxy. If this is unset it inherits it from the global setting
username username to use for basic authentication to a repo or really any url. If this is unset it inherits it from the global setting
password password to use with the username for basic authentication. If this is unset it inherits it from the global setting
cost relative cost of accessing this repository. Useful for weighing one repo's packages as greater/less than any other. defaults to 1000
skip_if_unavailable If set to True yum will continue running if this repository cannot be contacted for any reason. This should be set carefully as all repos are consulted for any given command. Defaults to False
$releasever This will be replaced with the value of the version of the package listed in distroverpkg. This defaults to the version of 'redhat-release' package.
$arch This will be replaced with your architecture as listed by os.uname()[4] in Python.
$basearch This will be replaced with your base architecture in yum. For example, if your $arch is i686 your $basearch will be i386.
$uuid This will be replaced with a unique but persistent uuid for this machine. The value that is first generated will be stored in /var/lib/yum/uuid and reused until this file is deleted.
$YUM0-$YUM9 These will be replaced with the value of the shell environment variable of the same name. If the shell environment variable does not exist then the configuration file variable will not be replaced.
obsoletes 就會(huì)被 priorities 插件禁掉。這樣互掐的功能,難免讓人覺得有些不爽。
因此,也會(huì)有如下的言論: http://wiki.centos.org/PackageManagement/Yum/Priorities
Note: The upstream maintainer of yum, Seth Vidal, had the following to say about 'yum priorities' in September 2009:
Gosh, I hope people do not set up yum priorities. There are so many things about
priorities that make me cringe all over. It could just be that it reminds me of
apt 'pinning' and that makes me want to hurl. 作者: duanjigang 時(shí)間: 2013-01-04 19:13 本帖最后由 duanjigang 于 2013-01-04 19:18 編輯
yum 插件例子之一: 在所有 hook 點(diǎn)打印信息
如下是我寫的一個(gè) test 插件的例子,注意在5u7 或者更高版本 OS 上運(yùn)行。
配置如下: