Description: After the online plagiarism and their own summary and experiment, very detailed, can be left for reference.
There are generally two ways to configure Yum: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.
One, yum configuration file yum.conf detailed
$Cat/etc/Yum. conf [Main]cachedir=/var/cache/Yum#yum下载的RPM包的缓存目录keepcache=0#缓存是否保存, 1 saved, 0 not saved. DebugLevel=2#调试级别 (0-Ten), the default is 2 (the specific debug level of the application, I do not understand). LogFile=/var/log/Yum. Log #yum的日志文件所在的位置exactarch=1#在更新的时候, whether to allow the updating of different versions of the RPM package, such as whether to update the i686 RPM package on i386. Obsoletes=1#这是一个update的参数, for more details, see Yum (8), simply the equivalent of upgrade, allowing the updating of stale RPM packages. Gpgcheck=1#是否检查GPG (GNU Private Guard), a key-mode signature. Plugins=1#是否允许使用插件, the default is 0 not allowed, but we usually use yum-Fastestmirror this plugin. Installonly_limit=3#允许保留多少个内核包. Exclude=selinux*#屏蔽不想更新的RPM包, wildcards can be used, and multiple RPM packages are separated by a space. # This is the default,ifYou MakeThis biggerYumWon'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" forit byYumNot has correct# information.# It is esp. important, to has correct metadata, forDistributions like# FedorawhichDon'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 would DoThis ). # Metadata_expire=90m# PUT YOUR REPOS here or in separate files namedfile. repo#inch/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-brought repo file as an example to explore (fedora and Redhat are consistent) (#号后面是我加的注释):
[Fedora] #方括号里面的是软件源的名称, will be acquired by Yum and recognized by the name=fedora $releasever-$basearch#这里也定义了软件 the name of the warehouse, usually for the convenience of reading the configuration file, is generally useless, $releasever variable defines the release version, usually 8,9 , 10 and so on, $basearch variable defines the architecture of the system, which can be i386, x86_64, PPC equivalents, which have different values depending on the current system version architecture, which makes it easy for Yum to choose the right package for the current system when upgrading. With the same ... Failovermethod=the priority #failovermethod has two values to choose from, which 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 updating of certain packages in this repository, you can use wildcards and separate them with spaces, which you can add yourself if necessary #baseurl =http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/everything/$basearch/os/# The above line BaseURL the first character is ' # ' to indicate that the line has been commented and will not be read, this line means specifying a baseurl (the source's mirror server address) #mirrorlist =http:// mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever &arch= $basearch #上面的这一行是指定一个镜像服务器的地址列表, which is usually turned on, with the comment symbol disabled in this example, we can try to replace $releasever and $basearch with their corresponding versions and schemas, such as 10 and i386, Open in the browser, we can see a list of mirror server addresses available for a long series of mirrors. 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/oshttp//Ftp.chg.ru/pub/linux/fedora/linux/releases/10/everything/i386/oshttp//Ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/10/everything/i386/oshttp//Mirror.nus.edu.sg/fedora/releases/10/everything/i386/oshttp//Mirror.yandex.ru/fedora/linux/releases/10/everything/i386/oshttp//Ftp.twaren.net/linux/fedora/linux/releases/10/everything/i386/oshttp//Ftp.itu.edu.tr/mirror/fedora/linux/releases/10/everything/i386/osenabled=1 #这个选项表示这个repo中定义的源是启用的, 0 is disabled gpgcheck=1 #这个选项表示这个repo中下载的rpm将进行gpg的校验, the source of RPM packages has been determined to be effective and secure Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-fedora-$basearch #定义用于校验的gpg密钥, is the location of the digital signature of the public key file! # #以下的软件仓库基本上用不到, option meaning ibid. [Fedora-Debuginfo]name=fedora $releasever-$basearch-Debugfailovermethod=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= $basearchEnabled=0Gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-fedora-$basearch[Fedora-Source]name=fedora $releasever-Sourcefailovermethod=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= $basearchEnabled=0Gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-fedora-$basearch
Let 's take a look at the repo file rhel5.8 comes with.
Yum cat rhel-Debuginfo.repo [Rhel-debuginfo]name=red Hat Enterprise Linux $releasever-$ Basearch- Debugbaseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$ releasever/en/os/$basearch/debuginfo/enabled=0Gpgcheck=1Gpgkey= file://etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
The local Yum Library I set myself
Yum Cat Dvd.repo [Dvd]name=install dvdbaseurl=file:///Mnt/server enabled=1gpgcheck=0
Very simple. You can use the following command to see if all container configurations (Repository) are in effect
Yum repolist All
All container configurations are listed using the all parameter, and if none is listed only for available repository, this availability depends on the enabled parameter in the repo configuration file, if 0, is not available, and 1 is available for example:
[[Email protected]Yum. repos.d]#Yumrepolist allloaded Plugins:katello, product-ID, Security, subscription-managerupdating Certificate-based repositories. Unable to read consumer IdentityrepoIDRepo Name StatusdvdInstallDvdenabled:3,285Rhel-debuginfo Red Hat Enterprise Linux 5server-x86_64-Debug disabledrepolist:3,285
Show DVD This repository is available, there are 3,285 files, rhel-debuginfo This library is not available.
If you modify Rhel-debuginfo in the enabled 1 and then look again
[[Email protected]Yum. repos.d]#Yumrepolist allloaded Plugins:katello, product-ID, Security, subscription-managerupdating Certificate-based repositories. Unable to read consumer identityFTP://ftp.redhat.com/pub/redhat/linux/enterprise/5server/en/os/x86_64/debuginfo/repodata/repomd.xml: [Errno 4] IOError: <urlopen error ( -3, ' temporary failure in name resolution ') >Trying Other Mirror.repoIDRepo Name StatusdvdInstallDVD Enabled:3,285Rhel-debuginfo Red Hat Enterprise Linux 5server-x86_64-debugenabled:0repolist:3,285
A detailed description of the Linux yum configuration file