yum yum configuration and source configuration

yum.conf Profile Description

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

main section defines the 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 section of the source / server, there may be one or more. Each file is usually located under the /etc/yum.repo.d directory. 
yum.conf files are typically located in the / etc directory, which typically contains only part of the main configuration options.

  

yum.repos.d @ localhost root] # CAT /etc/yum.conf 
[main]    
  // global configuration file cacheDir is = / var / Cache / yum / $ basearch / $ releasever
  // cache directory yum, yum stored in this cache rpm packages and databases keepcache = 0
   // whether the download reservation keepcache rpm installation package is not 0 reserved (reserved 1), the default is 0 debuglevel = 2
   // the Debug output level information, the default is 2 logfile = / var / log / yum.log
    // log output location exactarch = 1
   // 0 and 1 have two options, set to 1 yum will install the system and hardware architecture matching packages, the default is 1 Obsoletes = 1
  // this is an update parameter allows to update the old package gpgcheck = 1
  // whether gpg efficacy, 1 representatives efficacy plugins = 1
   // whether to enable plugins installonly_limit = 5 bugtracker_url = http: //bugs.centos.org/set_project.php? project_id = 23 & ref = http: //bugs.centos.org/bug_report_page.php category = yum? distroverpkg=centos-release # This is the default, if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information. # It is esp. important, to have correct metadata, for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage, it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d [root@localhost yum.repos.d]#

 

repo file

 

All repository server settings should follow the following format:

 

[serverid]
name=Some name for this server
baseurl=url://path/to/repository/

 

  • serverid different for each repository distinction must have a unique name;
  • name is a description of repository to support such variables as $ releasever $ basearch;
  • 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/

 

Supported protocols which have url http: // ftp: // file: // three. After baseurl can with multiple url, you can change yourself the faster mirror sites, but baseurl 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.

About variables

  • $ Releasever: represents the 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.
  • = Enabled [. 1 or 0]
    # When a depot is arranged when enabled = 0, yum repository providing a source as does the package installation or upgrade package. 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

b. introducing GPG KEY

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-CentOS-5 a plain text file or the like, to download them, and then rpm --import RPM-GPG-kEY-CentOS-5 command to import the key.

 

repo custom editor

When you define a repo file, the location information is acquired software baseurl specified path, designated as repodata of the parent directory

 

 

[yum.repos.d the root @ localhost] # CAT kubernetes.repo 
[Kubernetes] 
name = Kubernetes the repo Edit 
BaseURL = HTTPS: //mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ 
gpgcheck. 1 = 
   // enable gpg efficacy gpgkey = HTTPS: //mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
  // specify efficacy profile, it is not specified by the imported file rpm --import enable. 1 =
  @ Enabling warehouse [root @ localhost yum.repos.d] #

  

 

root@localhost yum.repos.d]# yum remove all
Loaded plugins: fastestmirror
No Match for argument: all
No Packages marked for removal
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                               | 3.6 kB  00:00:00     
docker-ce-stable                                                                   | 3.5 kB  00:00:00     
extras                                                                             | 3.4 kB  00:00:00     
kubernetes                                                                         | 1.4 kB  00:00:00     
Updates | 4.3 kB 00:00:00      
(1.3): kubernetes / primary | 50K 12:00:00      
(3.2): kubernetes / filelists | 18 kB 12:00:00      
(3.3): kubernetes / Other | 33 kB 00:00:00      
kubernetes 363/363 
kubernetes 363/363 
kubernetes 363/363
Metadata Cache Created
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                        repo name                                            status
base/7/x86_64                                  CentOS-7 - Base - 163.com                            10,019
docker-ce-stable/x86_64                        Docker CE Stable - x86_64                                46
extras/7/x86_64                                CentOS-7 - Extras - 163.com                             419
kubernetes                                     Kubernetes repo edit                                    363
updates/7/x86_64                               CentOS-7 - Updates - 163.com                          2,146
repolist: 12,993

  

 

Guess you like

Origin www.cnblogs.com/zy09/p/11127572.html