Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of the steps to update YUM source in CentOS7

Detailed explanation of the steps to update YUM source in CentOS7

藏色散人
藏色散人forward
2021-04-27 16:55:086168browse

The following tutorial column will introduce you to the steps of updating the YUM source of CentOS 7. I hope it will be helpful to friends who need it! CentOS 7 update YUM source steps

Step1 Find the required source

Alibaba open source mirror site has all kinds of sources. The old domain name is https://mirrors.aliyun.com/

Step2 Edit the CentOS7.repo file

Enter

/etc/yum.repos.d

, I found that my source is still

7.4.1708

<pre class="brush:php;toolbar:false">[base] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7.4.1708/updates/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7.4.1708/extras/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7.4.1708/centosplus/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7.4.1708/contrib/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7</pre>. This version of the source has been migrated to 7.5.1804 , → address, use VIM to replace it

:%s/7.4.1708/7.7.1908/g

Step3 Fix the conflict errorThen try to update the system

yum -y update

[root@liaogx ~]# yum -y update
Plugin "product-id" can't be imported
Plugin "search-disabled-repos" can't be imported
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package ModemManager.x86_64 0:1.6.0-2.el7 will be updated
......此处略......
---> Package yum-rhn-plugin.noarch 0:2.0.1-10.el7 will be installed
--> Running transaction check
---> Package libbytesize.x86_64 0:1.2-1.el7 will be installed
---> Package python2-pytoml.noarch 0:0.1.18-1.el7 will be installed
---> Package volume_key-libs.x86_64 0:0.3.9-8.el7 will be installed
--> Processing Conflict: initscripts-9.49.41-1.el7_5.1.x86_64 conflicts redhat-release < 7.5-0.11
--> Finished Dependency Resolution
Error: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64
 You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
PackageKit-1.1.5-1.el7.centos.x86_64 has missing requires of PackageKit-backend
rhn-check-2.0.2-17.el7.noarch has missing requires of yum-rhn-plugin >= ('0', '1.6.4', '1')
[root@liaogx ~]#

If the error is reported The following errorError: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64

This is caused by the conflict between the updated software package and the original version. There are two solutions.

Exclude conflicts through the keyword initscritps:

yum update --exclude=kernel* --exclude=centos-release* --exclude=initscripts*

  • Delete conflicting packages: rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps
  • ##The second method is used here to remove conflicting packages. <pre class="brush:php;toolbar:false">[root@liaogx ~]# rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release: remove failed: No such file or directory warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-rhx: remove failed: No such file or directory warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-release: remove failed: No such file or directory warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-former: remove failed: No such file or directory warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta: remove failed: No such file or directory [root@liaogx ~]#</pre>Step4 Update system
Novices will know how to do it from entry to running,

sudo yum -y update

, even veterans understand it.

[root@liaogx ~]# yum -y update
......此处省略10分钟......
Complete!
[root@liaogx ~]#

Update successful ^_^

The above is the detailed content of Detailed explanation of the steps to update YUM source in CentOS7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete