Configuration of the Yum source

Source: Internet
Author: User
Tags gpg

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!
Yum's work is not complicated, and every RPM software's head (header) records the dependencies of the software, so if you can record the contents of the header and analyze it, you know what additional basic software is required for each software installation. That is, the server above the analysis tool to analyze all the RPM files, and then record the analysis, as long as the installation or upgrade to query the record of the file, you can know all the associated software. So Yum's basic workflow is as follows:
Server-side: All the RPM packages are stored on the server, and then the dependencies of each RPM file are analyzed with related functions, and the data is recorded in a specific directory on the server.
Client: If you need to install a software, first download the server record of the dependency relationship file (can be www or FTP), through the server-side download record data analysis, and then get all the relevant software, all at once downloaded to install.

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

#cachedir: Yum cache directory, yum stores downloaded RPM packages and databases, typically/var/cache/yum/$basearch/$releasever.

Keepcache=1

#keepcache: Whether to preserve cached content, 0: To remove packages after installation, 1 to retain packages after installation

debuglevel=2
#debuglevel: Debug level, 0──10, default is 2 seemingly only record installation and deletion records
Logfile=/var/log/yum.log
Pkgpolicy=newest
#pkgpolicy: The policy for the package. A total of two options, newest and last, this role is if you set up multiple repository, and the same software in different repository exist simultaneously, Yum should install which, if it is newest, yum will install the latest version. If it is last, Yum will sort the server ID alphabetically and select the software installation on the final server. Newest is generally chosen.
Distroverpkg=centos-release
#指定一个软件包, Yum will determine your distribution based on this package, either by default, Redhat-release, or by installing any RPM packages for its own release version.
Tolerant=1
#tolerent, there are 1 and 2 options that indicate whether Yum tolerates a package-related error on the command line, such as installing a three-by-five package, where 3 has already been installed, and if you set it to 1, Yum will not have an error message. The default is 0.
Exactarch=1
#exactarch, there are two options 1 and 0, which represent whether to upgrade only the packages that are consistent with your installation of the package CPU, and if set to 1, if you install a i386 rpm, Yum will not upgrade with a 1686 package.
Retries=20
#retries, the number of retries after a network connection error has occurred, and if set to 0, it will be retried indefinitely.
Obsoletes=1
Gpgcheck=1
#gpgchkeck = There are 1 and 2 choices, respectively, whether or not GPG verification, if not, the default is checked.
REPOSDIR=/ETC/YY.RM #默认是/etc/yum.repos.d/lower xx.repo suffix file
#默认都会被include come in and that means/etc/yum.repos.d/xx.repo no matter how many of the profiles there are in each of the number of [name] is actually integrated into one inside see is the duplicate [name] behind the overwrite of the previous
Exclude=xxx
#exclude exclude some software from the upgrade list, you can use wildcards, the list of items to be separated by a space, which is installed such as beautify the package, Chinese patches of friends especially useful.
Keepcache=[1 or 0]
# set Keepcache=1,yum to retain the cached header files (headers) and packages after the package has been successfully installed. The default value is keepcache=0 not saved

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

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

[ServerID]
#其中serverid是用于区别各个不同的repository, there must be a unique name. Repeat the previous overlay--or vice versa??? Using the enabled test is the back cover front
Name=some name for this server
#name is a description of repository, supporting variables such as $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 kinds. After BaseURL can be followed by multiple URLs, you can change 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 where the URL points to must be the upper level of the Repository header directory, and it also supports variables such as $releasever $basearch.

#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.

You can add multiple options after the URL, such as Gpgcheck, Exclude, Failovermethod, and so on, such as:

Gpgcheck=1
Exclude=gaim
#其中gpgcheck, the meaning of exclude is the same as the [main] part, but only works on this server,
Failovermethod=priority
#failovermethode There are two options roundrobin and priority, meaning that when there are multiple URLs to choose from, Yum selects the order, Roundrobin is randomly selected, if the connection fails then use the next, loop in turn, Priority is based on the order of the URLs, starting with the first one. If not specified, the default is Roundrobin.

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

Several variables
$releasever, the release version, obtained from the [main] section of distroverpkg, if not, according to 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 the same genus I386,alpha and Alphaev6 Alpha.
With the yum.conf set up, we can enjoy the convenience of Yum.

There is one more thing that has not been done. That is to import each reposity GPG key, previously said, Yum can use GPG to verify the package, to ensure the integrity of the download package, so we have to go to each repository site to find GPG key, will generally be placed on the homepage of the eye-catching position, some names such as Rpm-gpg-key.txt such as plain text files, download them, and then use the RPM--import xxx.txt command to import them, it is best to bring the release of Gpg-key also imported, RPM--import/usr/share/doc/ Redhat-release-*/rpm-gpg-key official software upgrades are available.

Configuration of the Yum source

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.