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. Every RPM is soft.
What is a repo file?
The repo file is FEdIn ora, the configuration file of the yum source (software warehouse), usually 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, all associated software can be known. 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
# Cachedir: directory of the yum cache, where yum stores the downloaded rpm package and database, generally/var/cache/yum.
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 willIdIn 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 two options: 1 and 0, indicating whether yum can tolerateCommandFor example, if you want to install packages 1, 2, and 3, and 3 have already been installed, 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 and install the software package.CpIf the u system is consistent, if it is set to 1, if you install 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.
# By defaultNcLude comes in, 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 ??? UseEnableD. The test is to overwrite the previous one.
Name = Some name for this server
# Name: A repository description. It supports variables such as $ releasever $ basearch. name = Fedora Core $ releasever-$ basearch-ReleaSedUpDateS
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 http ://Ftp: // File: // three types. 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 andArchitectureFor example, 10 and i386 can be opened in a browser, so we can 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.
Example
[Base]
Name = Server
Baseurl = ftp: // 192.168.0.120/pub/Server
Enabled = 1
Gpgcheck = 0
[Cluster]
Name = Cluster
Baseurl = ftp: // 192.168.0.120/pub/Cluster
Enabled = 1
Gpgcheck = 0
[ClusterStorage]
Name = ClusterStorage
Baseurl = ftp: // 192.168.0.120/pub/ClusterStorage
Enabled = 1
Gpgcheck = 0
[VT]
Name = VT
Baseurl = ftp: // 192.168.0.120/pub/VT
Enabled = 1
Gpgcheck = 0