Yum configuration generally has two ways, one is to configure the yum.conf file in the/etc directory directly, and the other is to add the. repo file under the/ETC/YUM.REPOS.D directory.
A. Yum configuration file
$ cat/etc/yum.conf
[Main]
Cachedir=/var/cache/yum #yum下载的RPM包的缓存目录
Keepcache=0 #缓存是否保存, 1 save, 0 not saved.
debuglevel=2 #调试级别 (0-10), default is 2 (specific debug level of application, I do not understand).
Logfile=/var/log/yum.log #yum的日志文件所在的位置
Exactarch=1 #在更新的时候 whether to allow updating different versions of RPM packages, such as whether to update i686 RPM packages on i386.
Obsoletes=1 #这是一个update的参数, please refer to Yum (8), which is simply equivalent to upgrade, allowing the updating of stale RPM packages.
Gpgcheck=1 #是否检查GPG (GNU Private Guard), a key-mode signature.
Plugins=1 #是否允许使用插件, the default is 0 is not allowed, but we generally use yum-fastestmirror this plugin.
Installonly_limit=3 #允许保留多少个内核包.
exclude=selinux* #屏蔽不想更新的RPM包, wildcards can be used, separated by a space between multiple RPM packages.
# This is the default and if you do this bigger Yum won ' t see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not have to
# Download the new metadata and ' pay ' for it by Yum don't have correct
# information.
# It is the esp. important, to has correct metadata, for distributions like
# Fedora which don ' t keep old packages around. If you don ' t like this checking
# interupting your command line usage, it's much better to has something
# Manually check the metadata once an hour (Yum-updatesd'll do).
# metadata_expire=90m
# PUT YOUR REPOS here or in separate files named File.repo
# IN/ETC/YUM.REPOS.D
Second, *.repo document detailed
What is a repo file?
The repo file is a configuration file for the Yum source (software repository) in fedora, typically a repo file defines the details of one or more repositories, such as where we will download packages that need to be installed or upgraded, and the settings in the repo file will be read and applied by Yum!
We use a system to bring the repo file as an example to explore (#号后面是我加的注释):
[Fedora] #方括号里面的是软件源的名称, will be acquired and recognized by Yum
Name=fedora $releasever-$basearch #这里也定义了软件 the name of the warehouse, usually for the convenience of reading the configuration file, generally does not work, $releasever variables define the release version, usually 8,9,10 and other numbers, $ The Basearch variable defines the architecture of the system, which can be i386, x86_64, PPC equivalents, which have different values depending on the current version of the system, which makes it easy for Yum to choose a package that fits the current system when it is upgraded to the same ...
Failovermethod=priority #failovermethod has two values to choose from, priority is the default value, which indicates that the mirror server address is selected from the list of BaseURL, Roundrobin is randomly selected in the listed server
exclude=compiz* *compiz* fusion-icon* #exclude这个选项是后来我自己加上去的, used to prohibit the installation and update of some software packages in this repository, you can use wildcards and separate them with spaces, and you can add them yourself as appropriate.
#baseurl =http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/everything/$basearch/os/
#上面的一行baseurl第一个字符是 ' # ' means that the line has been commented and will not be read, which means specifying a baseurl (the source's mirror server address)
#mirrorlist =http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever &arch= $basearch
#上面的这一行是指定一个镜像服务器的地址列表, usually open, in this case add the comment symbol is disabled, we can try to replace $releasever and $basearch with their corresponding version and schema, such as 10 and i386, opened in the browser, We'll be able to see a long list of mirror server address lists available.
Choose your own access faster mirror server address copy and paste into the repo file, we can get a faster update speed, the format is as follows BaseURL:
Baseurl=
Ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/releases/10/Everything/i386/os
Http://ftp.chg.ru/pub/Linux/fedora/linux/releases/10/Everything/i386/os
Http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/10/Everything/i386/os
Http://mirror.nus.edu.sg/fedora/releases/10/Everything/i386/os
Http://mirror.yandex.ru/fedora/linux/releases/10/Everything/i386/os
Http://ftp.twaren.net/Linux/Fedora/linux/releases/10/Everything/i386/os
Http://ftp.itu.edu.tr/Mirror/Fedora/linux/releases/10/Everything/i386/os
Enabled=1 #这个选项表示这个repo中定义的源是启用的, 0 is disabled
Gpgcheck=1 #这个选项表示这个repo中下载的rpm将进行gpg的校验, it has been determined that the source of the RPM package is valid and safe
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-fedora-$basearch #定义用于校验的gpg密钥
# #以下的软件仓库基本上用不到, option meaning ditto
[Fedora-debuginfo]
Name=fedora $releasever-$basearch-debug
Failovermethod=priority
#baseurl =http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/everything/$basearch/debug/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever &arch= $basearch
Enabled=0
Gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-fedora-$basearch
[Fedora-source]
Name=fedora $releasever-source
Failovermethod=priority
#baseurl =http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/everything/source/srpms/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever &arch= $basearch
Enabled=0
Gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-fedora-$basearch
Yum configuration and use (very detailed)