Detailed description of the configuration file repo of CentOS yum

Source: Internet
Author: User
Tags gpg

Detailed description of the configuration file repo of CentOS yum

What is a repo file?
The repo file is the configuration file of the yum source (software warehouse) in Fedora. Generally, a repo file defines the details of one or more software warehouse, for example, we will download the software package to be installed or upgraded from where, and the setting content in the repo file will be read and applied by yum!
The operating principle of YUM is not complex. The dependency between the software is recorded in the header of each RPM software. If the content of the header can be recorded and analyzed, you can know which basic software needs to be installed before each software is installed. That is to say, on the server, analyze all RPM files with an analysis tool, and then record the analysis as long as the files recorded are queried during installation or upgrade, to know all associated software. The basic workflow of YUM is as follows:
Server: stores all RPM software packages on the server, and analyzes the dependency between each RPM file with relevant functions, record the data into files stored in a specific directory on the server.
Client: If you need to install a software, download the dependency file recorded on the server (via WWW or FTP) and analyze the record data downloaded from the server, then obtain all the relevant software and download it all at a time for installation.

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

# Cachedir: Directory cached by yum. The rpm package and Database downloaded by yum are stored in/var/cache/yum/$ basearch/$ releasever.

Keepcache = 1


# Keepcache: indicates whether the cached content is retained. 0: indicates that the software package is deleted after installation. 1 indicates that the software package is retained after installation.

Debuglevel = 2
# Debuglevel: Debugging level, 0-10. The default value is 2. It seems that only installation and deletion records are recorded.
Logfile =/var/log/yum. log
Pkgpolicy = newest
# Pkgpolicy: the package policy. There are two options: newest and last. If you set multiple repository and the same software is stored in different repository, which one should yum install, if it is newest, yum will install the latest version. If it is last, yum will sort the server IDs in alphabetical order and select the software installation on the last server. Generally, select newest.
Distroverpkg = CentOS-release
# Specify a software package. yum determines your release version based on this package. The default value is RedHat-release, or any installed rpm package for your own release.
Tolerant = 1
# Tolerent, which also has options 1 and 0, indicates whether yum can tolerate errors related to software packages in command lines. For example, if you want to install packages 1, 2, and 3, 3 of them have been installed before. If you set it to 1, yum will not have an error message. The default value is 0.
Exactarch = 1
# Exactarch, which has two options: 1 and 0. It indicates whether to upgrade only the same package as the cpu system of your installation package. If it is set to 1, if you have installed an i386 rpm, yum will not be upgraded with a 1686 package.
Retries = 20
# Retries: the number of retries after a network connection error occurs. If it is set to 0, there will be unlimited retries.
Obsoletes = 1
Gpgcheck = 1
# Gpgchkeck = there are two options: 1 and 0, which respectively indicate whether or not to perform gpg verification. If this option is not selected, it is checked by default.
Reposdir =/etc/yy. rm # The default value is/etc/yum. repos. d/The xx. repo suffix file is low.
# It will be included by default, that is,/etc/yum. repos. d/xx. repo no matter how many [names] are in the configuration file, it is actually integrated into one file to see that it is repeated [name] followed by overwrite the previous
Exclude = xxx
# Exclude some software from the upgrade list. Wildcards can be used to separate each item in the list with spaces. This is especially useful for users who have installed Chinese patches such as beautification packages.
Keepcache = [1 or 0]
# Set keepcache = 1. After the software package is successfully installed, yum retains the cached headers and software packages. The default value is keepcache = 0. Do not save

Reposdir = [absolute path to the directory containing the. repo file]
# This option specifies the absolute path of the. repo file .. The repo file contains information about the software repository (the function is the same as the [repository] segment in the/etc/yum. conf file ).

Part 2:
Vi/etc/yum. repo. d/xx. repo
You can also directly configure this field in yum. conf.

[Serverid]
# Serverid is used to distinguish different repository. It must have a unique name. Repeat the previous steps to overwrite the back -- or is it the opposite ??? In the enabled test, the front is overwritten.
Name = Some name for this server
# Name: A repository description. It supports variables such as $ releasever $ basearch. name = Fedora Core $ releasever-$ basearch-Released Updates
Baseurl = url: // path/to/repository/
# Baseurl is the most important part in server settings. You can obtain the software from it only when the settings are correct. The format is:
Baseurl = url: // server1/path/to/repository/
Url: // server2/path/to/repository/
Url: // server3/path/to/repository/
# The url supports three protocols: http: // ftp: // file. After baseurl, it can be followed by multiple URLs. You can change it to an image site with a high speed, but there can only be one baseurl, that is, it cannot be in 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 the repository header directory. It also supports variables such as $ releasever $ basearch.

# Items list = http://mirrors.fedoraproject.org/mirrorlist? Repo = fedora-$ releasever & arch = $ basearch
# The above line specifies the address list of an image server, which is usually enabled. In this example, the annotation symbol is disabled. We can try it, replace $ releasever and $ basearch with their own version and architecture, such as 10 and i386. Open the browser and we will see a long list of available mirror server addresses.

You can add multiple options after the url, such as gpgcheck, exclude, and failovermethod. For example:

Gpgcheck = 1
Exclude = gaim
# The meaning of gpgcheck and exclude is the same as that of [main], but this server only works,
Failovermethod = priority
# Failovermethode has two options: roundrobin and priority, which indicate the order of the yum options when multiple URLs are available. roundrobin is selected randomly. If the connection fails, use the next one, in turn, priority starts from the first url order. If not specified, the default value is roundrobin.

Enabled = [1 or 0]
# When a software repository is configured with enabled = 0, yum does not provide the repository as the source of the software package when installing or upgrading the software package. You can use this option to enable or disable a software repository.
# Use the -- enablerepo = [repo_name] And -- disablerepo = [repo_name] Options of yum, or use the "Add/delete software" tool of PackageKit, you can also easily enable or disable a specified software repository.

Several Variables
$ Releasever: the version of the release, which is obtained from distroverpkg in the [main] section. If not, the redhat-release package is used for determination.
$ Arch, cpu system, such as i686 and athlon
$ Basearch: Basic cpu system group. For example, i686 and athlon belong to the same i386, and alpha and alphaev6 belong to the same alpha.
After setting yum. conf, we can enjoy the convenience of yum.

One more thing is not done. That is to import the GPG key of each reposity. As mentioned earlier, yum can use gpg to verify the package and ensure the integrity of the downloaded package. Therefore, we need to find the gpg key at each repository site first, usually on the home page eye-catching location, some names such as RPM-GPG-KEY.txt plain text files, download them, and then use rpm -- import xxx.txt command to import them, it is best to bring the release version of the built-in GPG-KEY is also imported, rpm -- import/usr/share/doc/redhat-release-*/RPM-GPG-KEY official software upgrade.

For more YUM tutorials, see the following:

RedHat 6.2 modify yum source in Linux use CentOS source for free

Configure the epel yum Source

Redhat local yum source configuration

Description of yum configuration file

Install yum in RedHat 6.1)

YUM installation and cleaning

Build yum local source on CentOS 6.4

This article permanently updates the link address:

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.