CentOS Yum configuration file Repo file detailed

Source: Internet
Author: User
What is a repo file.
The repo file is a configuration file for the Yum source (software warehouse) in fedora, usually a repo file that 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 repo files will be Yum read and applied.
Yum's work is not complicated, and each RPM software's header (header) records the software's dependencies, so if you can record the contents of the header and analyze it, you can see how each software needs to install additional basic software before installation. That is, the analysis tool is used to analyze all the RPM files on the server, and then the analysis is recorded, so that all associated software can be known as long as the file is queried for the record at the time of installation or upgrade. So the basic work flow of Yum is as follows:
Server side: All the RPM packages are stored on the server, then the dependencies of each RPM file are analyzed with related functions, and the data is recorded as files in a specific directory of the server.
Client: If you need to install a software, first download the server records of the dependency of the file (can be www or FTP), through the server-side download record data analysis, and then get all the relevant software, download all at once to install.

Vi/etc/yum.conf
[Main]
cachedir=/var/cache/yum/$basearch/$releasever

#cachedir: Yum cached Directories, yum the RPM packages and databases downloaded in this store, typically/var/cache/yum/$basearch/$releasever.

Keepcache=1

#keepcache: Whether to keep the cached content, 0: To delete the package after installation, and 1 to retain the package after installation debuglevel=2
#debuglevel: Debug level, 0──10, default is 2 appears to only record installation and deletion records
Logfile=/var/log/yum.log
Pkgpolicy=newest
#pkgpolicy: Package policy. A total of two options, newest and last, is that if you set up multiple repository, and the same software exists in different repository, Yum should install which, and if it is newest, yum installs the latest version. If this is last, then Yum sorts the server IDs alphabetically and selects the software installation on the final server. Newest is usually chosen.
Distroverpkg=centos-release
#指定一个软件包, Yum will judge your release based on this package, either by default Redhat-release or by any RPM packages that are installed for your own release.
Tolerant=1
#tolerent, there are 1 and 2 options that indicate whether Yum is tolerant of a package-related error in the command line, such as installing 1,2,3 three packages, 3 of which have already been installed, and if you set 1, Yum will not receive an error message. The default is 0.
Exactarch=1
#exactarch, there are two options 1 and 0 that represent whether to upgrade only packages that are consistent with the CPU system of your installation package, and if you set it to 1, if you install a i386 rpm, Yum will not be upgraded with a 1686 package.
Retries=20
#retries, the number of retries after a network connection error occurs, and if set to 0, the retry will be unlimited.
Obsoletes=1
Gpgcheck=1
#gpgchkeck = There are 1 and 2 choices, representing whether or not a GPG check is performed, and if not, the default is checked.
REPOSDIR=/ETC/YY.RM #默认是/etc/yum.repos.d/low xx.repo suffix file
#默认都会被include come in. That is to say/etc/yum.repos.d/xx.repo no matter how many of the configuration files there are in each of the number of [name] in the end is actually integrated into a inside look is the duplicate [name] behind the overlay
Exclude=xxx
#exclude exclude some software from the upgrade list, you can use wildcards, each item in the list should be separated by spaces, which is especially useful for friends who have installed a Chinese patch such as a landscaping package.
Keepcache=[1 or 0]
# set Keepcache=1,yum to keep the cached header files (headers) and packages after the package is successfully installed. The default value is keepcache=0 not saved

reposdir=[the absolute path of the directory containing the. repo file]
# This option specifies the absolute path to the. repo file. The. Repo file contains information about the software warehouse (the same effect as the [repository] fragment in the/etc/yum.conf file).

Part II:
Vi/etc/yum.repo.d/xx.repo
This field can actually be configured directly in the yum.conf

[ServerID]
#其中serverid是用于区别各个不同的repository, you must have a unique name. Repeat the front cover behind--or vice versa ... Using the enabled test is the back cover front
Name=some name for this server
#name is a description of the repository and supports variables such as the $releasever $basearch; Name=fedora Core $releasever-$basearch-released Updates
baseurl=url://path/to/repository/
#baseurl是服务器设置中最重要的部分, the software can be obtained from above only if it is set correctly. Its format is:
baseurl=url://server1/path/to/repository/
url://server2/path/to/repository/
url://server3/path/to/repository/
#其中url支持的协议有 http://ftp://file://three species. BaseURL can be followed by multiple URLs, you can change yourself to a faster mirror station, but BaseURL can only have one, that is, not like the following format:
baseurl=url://server1/path/to/repository/
baseurl=url://server2/path/to/repository/
baseurl=url://server3/path/to/repository/
The directory to which the URL points must be the upper level of this repository header directory, and it also supports variables such as $releasever $basearch.

#mirrorlist =http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever &arch= $basearch
#上面的这一行是指定一个镜像服务器的地址列表, which is usually turned on, with the annotation symbol disabled in this example, we can try to replace $releasever and $basearch with their own corresponding versions and schemas, such as 10 and i386, open in the browser, We can see a list of mirrored server addresses available for a long series of mirrors.

URLs can be followed by several options, such as Gpgcheck, exclude, failovermethod, etc., such as:

Gpgcheck=1
Exclude=gaim
#其中gpgcheck, the meaning of exclude is the same as the [main] section, but only works on this server,
Failovermethod=priority
#failovermethode There are two options roundrobin and priority, meaning that there are multiple URLs to choose from, yum the order of choice, Roundrobin is a random selection, if the connection fails to use the next, in turn, loop, Priority starts with the first in the order of the URLs. If not indicated, the default is Roundrobin.

Enabled=[1 or 0]
When #当某个软件仓库被配置成 enabled=0, Yum does not make the repository the source of the package when installing or upgrading the package. With this option, you can enable or disable the Software warehouse.
#通过 Yum--enablerepo=[repo_name] and--disablerepo=[repo_name] options, or easily enable and disable a specified software warehouse through the PackageKit Add/Remove software tool

Several variables
$releasever, the release version is obtained from DISTROVERPKG in the [main] section, if not, based on the Redhat-release package.
$arch, CPU system, such as I686,athlon, etc.
$basearch, the basic system groups of CPUs, such as i686 and Athlon, belong to I386,alpha and alphaev6 with Alpha.
The yum.conf setting is complete, we can experience the convenience of Yum.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.