当前位置:网站首页>[Yum] configuration and use of Yum source
[Yum] configuration and use of Yum source
2022-07-24 08:13:00 【sirria1】
One 、yum brief introduction
yum, yes Yellow dog Updater, Modified For short , It's Duke to improve RPM A package manager developed for package installability . At first it was by yellow dog The developer of this release Terra Soft Research and development , use python It's written in , It was also called yup(yellow dog updater), After the Duke University of [email protected] The development team makes improvements , Hence the name .yum Our goal is to automatically upgrade , install / remove rpm package , collect rpm Information about the package , Check dependencies and automatically prompt users to resolve .yum The key to success is to have reliable repository, seeing the name of a thing one thinks of its function , This is the repository of software , It can be http or ftp Site , It can also be a local software pool , But it has to include rpm Of header,header It includes rpm All kinds of information about the package , Include a description of , function , Documents provided , Dependency, etc . It's the collection of these header And analyze it , To automate the rest of the task .
yum The idea is to use a central warehouse (repository) Manage a part or even a distribution The relationship between different applications , Upgrade according to the calculated software dependency 、 install 、 Delete and so on , Less Linux Users have a headache all the time dependencies The problem of . This point ,yum and apt identical .apt originally debian Of deb Type software management used by , But now it can be used as well RedHat Under the door rpm 了 .
yum The main function is more convenient to add / Delete / to update RPM package , Automatically resolve package dependency issues , Easy to manage a large number of system updates .
yum Multiple repositories can be configured at the same time (Repository), Simple configuration file (/etc/yum.conf), Automatically resolve add or delete rpm The dependency problem encountered in the process of packaging , Keep up with RPM Database consistency .
Two 、yum install
CentOS It is installed by default yum, No additional installation is required , Here for experimental purposes , First the yum Uninstall and then re install .
1、 Check the default installation of the system yum
# rpm -qa|grep yum

2、 uninstall yum
# rpm -e yum-fastestmirror-1.1.16-14.el5.centos.1 yum-metadata-parser-1.1.2-3.el5.centos yum-3.2.22-33.el5.centos

3、 reinstall yum
Here you can go through wget Download and install the package from the Internet , You can also mount the system installation CD for installation , Here, select mount system installation CD to install .
# mount /dev/cdrom /mnt/cdrom/
# rpm -ivh yum-3.2.22-33.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
# yum -v
yum The basic installation package includes :
- yum //RPM installer/updater
- yum-fastestmirror //Yum plugin which chooses fastest repository from a mirrorlist
- yum-metadata-parser //A fast metadata parser for yum
Other installation packages are installed according to your own needs .

3、 ... and 、yum To configure
yum The configuration file of is divided into two parts :main and repository
- main Section defines global configuration options , Whole yum There should be only one configuration file main. Often located in /etc/yum.conf in .
- repository Section defines each source / The specific configuration of the server , There can be one or more . Often located in /etc/yum.repo.d In the files under the directory .
yum.conf Documents are usually located in /etc Under the table of contents , Generally, it only contains main Part of the configuration options .
# cat /etc/yum.conf

[main] cachedir=/var/cache/yum //yum Cached Directory ,yum Store the downloaded rpm Packages and databases , The default setting is /var/cache/yum keepcache=0 // Do you want to keep the package after installation ,0 In order not to keep ( The default is 0),1 For the sake of reservation debuglevel=2 //Debug Information output level , The scope is 0-10, Default is 2 logfile=/var/log/yum.log //yum Log file location . Users can go to /var/log/yum.log File to query for updates made in the past . pkgpolicy=newest // Package strategy . There are two options ,newest and last, This function is if you set up multiple repository, And the same software in different repository At the same time ,yum Which one should be installed , If it is newest, be yum Will install the latest version . If it is last, be yum The server will id In alphabetical order , And select the software installation on the last server . They usually choose newest. distroverpkg=redhat-release // Specify a package ,yum I'll judge your distribution based on this package , The default is redhat-release, It can also be installed for any of your own distributions rpm package . tolerant=1 // Yes 1 and 0 Two options , Express yum Tolerance of package related errors on the command line , For example, you need to install 1,2,3 Three bags , And one of 3 It has been installed before , If you set it to 1, be yum There will be no error messages . The default is 0. exactarch=1 // Yes 1 and 0 Two options , Set to 1, be yum Only packages that match the system architecture will be installed , for example ,yum Will not i686 The package is installed in a suitable i386 In the system . The default is 1. retries=6 // The number of retries after a network connection error , If it is set to 0, Will try again indefinitely . The default value is 6. obsoletes=1 // This is a update Parameters of , Please refer to yum(8), In short, it is equivalent to upgrade, Allow updates to obsolete RPM package . plugins=1 // Is plug-in enabled , Default 1 Is allowed ,0 It means that it is not allowed to . We usually use yum-fastestmirror This plugin . bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h installonly_limit = 5 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d

In addition to the above , There are also some options that can be added , Such as :
exclude=selinux* // Exclude some software from the upgrade list , You can use wildcards , Separate the items in the list with spaces , This is for the installation of such as beautification package , Chinese patch friends are particularly useful .
gpgcheck=1 // Yes 1 and 0 Two choices , They represent whether to carry out or not gpg(GNU Private Guard) check , To determine rpm The source of the package is efficient and secure . If this option is set to [main] part , For each repository Are effective . The default value is 0.
Four 、 Configure local yum Source
1、 Mount the system installation CD
# mount /dev/cdrom /mnt/cdrom/
2、 Configure local yum Source
# cd /etc/yum.repos.d/
# ls
You'll see four repo file

CentOS-Base.repo yes yum Configuration files for network sources
CentOS-Media.repo yes yum Configuration files for local sources
modify CentOS-Media.repo
# cat CentOS-Media.repo

# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c5-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c5-media [command]
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///mnt/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
stay baseurl The second part of the article is revised 2 The first path is /mnt/cdrom( That is the CD mount point )
take enabled=0 Change it to 1
3、 Disable default yum Network source
take yum Change the name of the network source configuration file to CentOS-Base.repo.bak, Otherwise, we will find the suitable package in the network source first , Read directly from local source after renaming .
4、 perform yum command
# yum install postgresql


About repo File format
all repository Server settings should follow the following format :
[serverid] name=Some name for this server baseurl=url://path/to/repository/
- serverid It's used to distinguish between different repository, There has to be a unique name ;
- name It's right repository Description of , Supporting image $releasever $basearch Such a variable ;
- baseurl Is the most important part of the server setup , Only the settings are correct , To get the software from it . Its format is :
baseurl=url://server1/path/to/repository/ url://server2/path/to/repository/ url://server3/path/to/repository/
among url The agreements supported are http:// ftp:// file:// Three .baseurl You can talk to more than one url, You can change it to a faster mirror station by yourself , but baseurl There can only be one , That is to say, it can't be in the following format :
baseurl=url://server1/path/to/repository/ baseurl=url://server2/path/to/repository/ baseurl=url://server3/path/to/repository/
among url The directory to point to must be this repository header Up the list , It also supports $releasever $basearch Such a variable .
url Then you can add multiple options , Such as gpgcheck、exclude、failovermethod etc. , such as :

[updates-released] name=Fedora Core $releasever - $basearch - Released Updates baseurl=http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch http://redhat.linux.ee/pub/fedora/linux/core/updates/$releasever/$basearch http://fr2.rpmfind.net/linux/fedora/core/updates/$releasever/$basearch gpgcheck=1 exclude=gaim failovermethod=priority

among gpgcheck,exclude And [main] Part of the same , But only for this server ,failovermethode There are two options roundrobin and priority, It means there are more than one url When options are available ,yum The order of choice ,roundrobin It's random selection , If the connection fails, use the next , In turn, cycle ,priority According to url We start with the first one . If not specified , The default is roundrobin.
5、 ... and 、 Configure domestic yum Source
By default yum The source speed is often unsatisfactory , For quick installation purposes , Modify it here yum The source is domestic .
Shanghai Jiaotong University yum Source
a. modify /etc/yum.repos.d/CentOS-Base.repo by :

# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

About variables
- $releasever: Represents the version of the distribution , from [main] Part of the distroverpkg obtain , without , According to redhat-release It's a judgment package .
- $arch:cpu system , Such as i686,athlon etc.
- $basearch:cpu The basic system group of , Such as i686 and athlon Of the same genus i386,alpha and alphaev6 Of the same genus alpha.
b. Import GPG KEY
yum have access to gpg Check the package , Ensure the integrity of the download package , So we have to go to each of the repository Site found gpg key, Generally, it will be placed in the eye-catching position of the home page , Some names like RPM-GPG-KEY-CentOS-5 Plain text files like that , Download them , And then use rpm --import RPM-GPG-KEY-CentOS-5 The order will key Import .
c. perform yum command

Other domestic yum The list of sources is as follows :
1. Enterprise contribution :
Sohu open source image station :Index of /
Netease open source image station : Welcome to Netease open source mirror station
2. University Teaching :
Beijing University of Technology :
http://mirror.bit.edu.cn (IPv4 only)
http://mirror.bit6.edu.cn (IPv6 only)
Beijing Jiaotong University :
http://mirror.bjtu.edu.cn (IPv4 only)
http://mirror6.bjtu.edu.cn (IPv6 only)
http://debian.bjtu.edu.cn (IPv4+IPv6)
Lanzhou University : Lanzhou University open source community mirror station
Xiamen University :Welcome to CentOS
Tsinghua University :
Tsinghua University open source software image station | Tsinghua Open Source Mirror (IPv4+IPv6)
http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
Tsinghua University open source software image station | Tsinghua Open Source Mirror (IPv4 only)
Tianjin University :http://mirror.tju.edu.cn/
University of science and technology of China :
USTC Open Source Software Mirror (IPv4+IPv6)
http://mirrors4.ustc.edu.cn/
http://mirrors6.ustc.edu.cn/
Northeast University :
http://mirror.neu.edu.cn/ (IPv4 only)
http://mirror.neu6.edu.cn/ (IPv6 only)
University of electronic technology :http://ubuntu.uestc.edu.cn/
6、 ... and 、 Using third-party software libraries
Centos/RHEL default yum The software warehouse is very limited , Only limited to the regular package and some software package updates in the release version , utilize RpmForge, You can add a lot of third parties rpm software package .RpmForge The library now has more than 10000 Species CentOS Software package , By CentOS The community believes that it is the safest and most stable third-party software library .
1、 install yum-priorities plug-in unit
This plug-in is used to set up yum The order in which the software source is called . Because the official software source , They are relatively stable and recommended for use . therefore , The order of official sources is higher than that of third-party sources . How to ensure this order , You need to install yum-priorities This plug-in has .
# yum -y install yum-priorities

2、 installed yum-priorities After the plug-in, you need to set /etc/yum.repos.d/ In the catalog .repo Related documents ( Such as CentOS-Base.repo), Insert sequence instructions into these files :priority=N (N by 1 To 99 The positive integer , The smaller the value, the better )
General configuration [base], [addons], [updates], [extras] Of priority=1,[CentOSplus], [contrib] Of priority=2, The other third source of software is :priority=N ( recommend N>10)
With CentOS-Base.repo For example :

[base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=1

3、 Download and install the corresponding rpmforge Of rpm Package
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
4、 install DAG Of PGP Key
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
5、 verification rpmforge Of rpm Package
# rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
6、 install rpmforge Of rpm Package
# rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm

7、 Set up /etc/yum.repos.d/rpmforge.repo The level of the source in the file
[[email protected] yum.repos.d]# cat rpmforge.repo

### Name: RPMforge RPM Repository for RHEL 5 - dag ### URL: http://rpmforge.net/ [rpmforge] name = RHEL $releasever - RPMforge.net - dag baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge #mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge enabled = 1 protect = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag gpgcheck = 1 priority=12

8、 Test installation
# yum install htop

Reference resources AdditionalResources/Repositories/RPMForge - CentOS Wiki
Other third-party software libraries such as EPEL(Extra Packages for Enterprise Linux ) and RPMFusion Installation and use of and RPMForge similar , You can find information and install by yourself .
边栏推荐
- nacos报错: ERROR Nacos failed to start, please see D:\nacos\logs\nacos.log for more details.
- P3916图的遍历 题解
- UVA572油田 Oil Deposits题解
- Debug NO2 check for errors according to the process
- [database] complete SQL statement
- Digital twin demonstration project -- Talking about simple pendulum (3) solid model exploration
- *Project recurrence * project implementation of thesis based on contextbasedemotionrecognitionusingematicdataset
- Why is knowledge base important? This is the best answer I've ever heard
- 图新地球:如何导入修改了高程基准(椭球)的CAD文件
- Hegong sky team vision training day4 - traditional vision, contour recognition
猜你喜欢

【游戏合集】手机都要被塞爆了,6款优质Pygame游戏合集降临~(附源码)

The code is tired. Stop and enjoy the top color matching~

What is NFT? An article to understand the concept of NFT
![[shutter] the shutter doctor reports an error](/img/09/20279b3ed71a18b28566ddbe212597.png)
[shutter] the shutter doctor reports an error

Debug No3 multi texture overlay
![[MySQL] installation tutorial and master-slave configuration](/img/79/0ad3f68b69a0a03a62422d4cc70035.png)
[MySQL] installation tutorial and master-slave configuration

13.Unity2D 横版 可上下左右移动的双向平台(双向行走+可移动+单独判定)+随机平台生成

Introduction of some functions or methods in DGL Library

NFT概念究竟是怎么回事。。全面了解NFT市场、技术和案例

我在微软的这六个月
随机推荐
Have you seen the interview questions of VR major? Trust me, it's absolutely useful
33 introduction to sparksql, dataframe and dataset
SIFT feature point extraction
Zhouzhihua machine learning watermelon book chapter 2 model evaluation and selection - accuracy and model generalization evaluation method, self-help method and integrated learning
Summary of study notes (I)
Is it safe to open an account online in Beijing
45. Jumping game II
[shutter] the shutter doctor reports an error
Anaconda cannot shut down the method of forced shutdown
how to add square on screenshot
Use of animation expert motionlayout layout
JSON extractor use in JMeter
P1739 expression bracket matching problem solution
warning: could not execute support code to read Objective-C class data in the process.
NFT是什么?一篇文章搞懂NFT的概念
Error reported by Nacos: error Nacos failed to start, please see d:\nacos\logs\nacos log for more details.
Intelligent robots and intelligent systems (Professor Zhengzheng of Dalian University of Technology) -- 4. Autonomous robots
Kotlin coroutine (II): scope and cancellation
how to add square on screenshot
Kubernetes: (I) basic concepts