yum and epel of Detailed

I. Overview

1. What is the repo file

in yum repo file is Fedora source (depot) configuration file, usually a repo file defines the details of the contents of one or more depots, for example, where we will need to download or install the upgrade package, set the repo files content will be read and applied yum

 

2, Yum works

YUM works is not complicated, each RPM software head (header) which will record the dependencies of the software, so if you can head down to the contents of the record and analyze the need for additional software can know each before installing What basic software installation. In other words, the first tool to analyze all the RPM files in the server above analysis, then analyze the record down, first check the record of the file as long as during the installation or upgrade, you can know all associated software.

 

3, YUM basic workflow

3.1, server-side

In the above server to store all of the RPM package, then the relevant functions to analyze each RPM file dependencies, these data are recorded as files stored within a particular directory server.

3.2 Client

If you need to install a software, first download the file server dependencies recorded above (by way of WWW or FTP), were analyzed by record data downloaded to the server, then get all the relevant software, once downloaded for all installation.

 

4, Yum configuration

4.1, Yum two parts of main and repository

yum configuration file is divided into two sections: main and repository

main: defines global configuration options, the entire yum configuration file should be only one main. Often located in /etc/yum.conf.

repository: defines the specific configuration of each of the source / server, there may be one or more. Each file is usually located under the /etc/yum.repo.d directory.

yum configuration mode is also divided into two types:

Yum.conf direct configuration files in the / etc directory, increased fragment repository

Increase .repo file in the directory /etc/yum.repos.d

4.2、/etc/yum.conf

[main]

cachedir = / var / cache / yum # cachedir: yum cache directory, yum rpm packages and databases in this storage download, typically / var / cache / yum.

debuglevel = 2 # debuglevel: debug level, 0──10, the default installation is two seemingly only records and delete records

logfile = / var / log / yum.log # logpath

 

pkgpolicy=newest

# Pkgpolicy: policy package. There are two options, newest and last, this role is if you set up multiple repository, and the same software at the same time there is in a different repository, yum should be installed which, if it is newest, then yum will install the latest version of the . If last, then yum server id will be in alphabetical order, and select the software installed on the server last. They are generally selected newest.

 

distroverpkg=centos-release

# Specify a package, yum will judge you according to release this package, the default is redhat-release, can be any rpm package installed for their own release.

 

tolerant=1

# Tolerent, there are two options 1 and 0, indicating whether yum tolerate errors associated with the command-line package occur, for example, you want to install three packages 1, 2, and 3 of which had been installed, if you set 1, the error message does not appear yum. The default is 0.

 

exactarch = 1

# Exactarch, there are two options 1 and 0, does it mean you just upgrade and install the same package package cpu system, if set to 1, if you a rpm i386 installed, the yum package does not come with 1686 upgrade.

 

retries = 20 # retries, the retry after the network connection error occurs, if set to 0, it will retry infinite.

obsoletes = 1 # This is an update of parameters, please refer to the specific yum (8), simply put, is equivalent to the upgrade, it allows updating the old RPM package

 

gpgcheck = 1 # gpgchkeck = 0 and 1 have two options, whether representing gpg check, to determine the source rpm package is effective and safe, if it is not a default is checked.

 

exclude=xxx

#exclude exclude certain software upgrades in addition to the list, you can use wildcards, list the items to use separated by a space, such as landscaping for this package is installed, the Chinese patch friend particularly useful.

 

keepcache=[1 or 0]

# Set keepcache = 1, yum retains cache after successful installation package headers (headers) and software package. The default value is not saved keepcache = 0

 

reposdir = [directory containing the files .repo absolute path]

# This option specifies the absolute path to the user .repo file. ([Repository] effect the same fragment /etc/yum.conf file) file containing information .repo depots.

 

4.3、/etc/yum.repo.d/xx.repo

In fact, this field can also be configured directly inside yum.conf

[Serverid] # software source / repository name, must have a unique name, if repeated, with enabled testing is behind the front cover

 

name=Some name for this server

# Name, a description of the repository to support such variables as $ releasever $ basearch,

# Can be written as [name = Fedora Core $ releasever - $ basearch - Released Updates]

$ Releasever variables define the release, usually 8,9,10 and other digital, $ basearch variable defines the architecture of the system, which can be i386, x86_64, ppc equivalent

# These two variables, depending on the version of the current system architectures have different values, which you can easily select the appropriate time yum upgrade packages in the current system, with the following

 

baseurl = url: // path / to / repository /

#baseurl server setup is the most important part, only the settings are correct, in order to obtain software from above. Its format is:

baseurl = url: // server1 / path / to / repository /

url://server2/path/to/repository/

url://server3/path/to/repository/

# Url which supports the following protocols http: // ftp: // file: // three. After baseurl can with multiple url, you can change yourself the faster mirror sites

# Baseurl but only one, that can not be like the following format:

baseurl = url: // server1 / path / to / repository /

baseurl url =: // server2 / path / to / repository /

baseurl = url: // Server3 / path / to / repository /

Which must be url points to a directory on the repository header directory level, it also supports the variable $ releasever $ basearch.

 

#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch

# Above this line is designated a mirror server address list, usually open, in this case added a note symbol disabled, we can try to replace $ releasever and $ basearch into their own corresponding versions and architectures, such as 10 and i386, opened in a browser, we can see a long list of mirror mirror server address list available.

 

After url plurality of options can be added, such as gpgcheck, exclude, failovermethod the like, such as:

gpgcheck = 1 # checking whether gpg

exclude = gaim # excluded from the list of some of the software upgrade

# Wherein gpgcheck, exclude the meaning and [main] the same section, but only acts on this server

failovermethod=priority

There are two options #failovermethode roundrobin and priority, meaning there are a plurality of alternative url time, the order of selection yum, roundrobin randomly selected, if the connection fails then the next, followed by cycle, priority according to the order from the url first start. If not specified, the default is roundrobin.

 

enabled=[1 or 0]

# When a depot is configured to enabled = 0 when, yum will not use this as a warehouse package provides source when you install or upgrade packages. With this option, you can enable or disable the software repository.

# Yum through the --enablerepo = [repo_name] and --disablerepo = [repo_name] option, or by PackageKit "Add / Remove Software" tool, you can easily enable and disable designated depots

 

4.3, several variables

$ Releasever: release version, available from distroverpkg [main] section, and if not, to judge according to the redhat-release package.

$ Arch: cpu system, such as i686, athlon, etc.

$ Basearch: Basic System cpu group, such as the i686 and belong athlon i386, alpha and alphaev6 belong alpha.

 

4.4, introducing GPG key of each reposity

As mentioned above, yum package can use gpg to verify and ensure the integrity of the download package, so we need to find each repository site gpg key, usually on the front page of eye-catching position, some names such as RPM-GPG-KEY plain text files like .txt, download them, and then use the command rpm --import xxx.txt import them, it is best to release comes with GPG-KEY also import, rpm --import / usr / share / doc / redhat-release - * / RPM-GPG-KEY official software upgrade used.

 

Two, epel

1. What is epel

If you both want to get RHEL high quality, high performance, high reliability, and the need to facilitate ease of use package update function (key free), then the Fedora Project launched EPEL (Extra Packages for Enterprise Linux) is perfect for you. EPEL (http://fedoraproject.org/wiki/EPEL) is built by the Fedora community, provides high-quality software package for the project and RHEL derivative distributions such as CentOS, Scientific Linux and so on.

 

2, how to obtain packages of EPEL

EPEL contains called 'epel-release' package, which includes information for the package gpg key signature and software source. After installing this package onto your Enterprise Linux, you can install packages and their dependencies use of tools like yum. By default, stable version EPEL warehouse is open. In addition to epel-release source, there is one called 'epel-testing' repository contains not yet be regarded as stable software Please consider risk-on their own. 

The user can directly CentOS yum install epel-release EPEL source is installed and enabled.

 

3, using the experience:

1, do not enchant yum original source, the installation will produce a new repo

2, epel have a lot of source address, if a case can not, it will go to another under

3, if you download the update package incomplete, it will not be installed. In this case, you can take care of dependencies

 

4、安装yum install yum-priorities

Yum Priorities plug-in can be used to enforce the protection of sources. It through various sources to set different priorities allows administrators to some source (such as Linux distributions official source) can be set to the highest priority to ensure the stability of the system (but also may not be updated to other source software available on the latest version).

 

Three, Yum source replacement

1, backup /etc/yum.repos.d/CentOS-Base.repo

2, download the corresponding version repo file into /etc/yum.repos.d/ (please make the appropriate backup before proceeding)

Centos7:

wget -P /etc/yum.repos.d http://mirrors.163.com/.help/CentOS7-Base-163.repo

3. Run the following command to generate cache

yum clean all

yum makecache

 

Four, Yum command

yum command options

--nogpgcheck: prohibited gpgcheck

-y: Automatic answer is "yes"

-q: silent mode

--disablerepo = repoidglob: Temporarily disable specified repo here

--enablerepo = repoidglob: Enables the specified temporary repo here

--noplugins: disable all plug-
          yum source list

yum repolist [all | enabled | disabled]: display a list of warehouse

yum grouplist: group display package

yum list {available | installed | updates}: display a list of packages

yum list vsftpd * and displaying packages that match vsftpd

yum install uninstall

yum install package

yum restall package: Redo

yum update package: update packages

yum check-update

yum remove package1 [package2]

Group and the installation package is substantially similar to the installation package, just before the install, restall group can be coupled with other operations. For example: yum -y groupinstall "Development Tools", if there are spaces, use double quotes included.

If you install the system when there is no desktop installation, you can use this command to install: yum -y groupinstall "GNOME Desktop" to install a graphical interface

yum query

yum info View package information

yum provides feature1

yum search xxx: search with a keyword of the installation package

yum cache

yum makecache: build the cache

yum clean all: clear all caches

yum history

yum history: yum display operating history, is carried out in accordance find /var/log/yum.log

yum history info 6 View Article information

yum history undo 6: Undo the sixth step, if the sixth step is to install, execute this command, the program will remove the installed sixth step. If the sixth step is to uninstall, then execute this command, the program will be installed uninstall

yum history redo 6: Redo the sixth step

V. Domestic revenue mirror sites

NetEase (http://mirrors.163.com/)

Ali (https://opsx.alibaba.com/mirror)

Tsinghua University (https://mirror.tuna.tsinghua.edu.cn/)

 

Sixth, reference documentation

Detailed yum-repo files, as well as epel Profile, yum source of replacement (https://www.cnblogs.com/nineep/p/6795692.html)

yum configuration using (very detailed) (https://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/09/2203916.html)

CentOS 7.0 yum local source address and the address priority yum configuration (https://blog.csdn.net/tantexian/article/details/38895449)

Detailed configuration and yum source (https://blog.csdn.net/qq_27754983/article/details/73693061)

Man Pages and the Online Linux
(http://www.man7.org/linux/man-pages/index.html) ----------------
Disclaimer: This article is CSDN bloggers " heavyfish 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/heavyfish/article/details/82808970

Guess you like

Origin www.cnblogs.com/weiguang/p/12040067.html