首頁 > 運維 > CentOS > 詳解CentOS7更新YUM來源步驟

詳解CentOS7更新YUM來源步驟

藏色散人
發布: 2021-04-27 18:54:38
轉載
6366 人瀏覽過

下面由centos教學專欄為大家介紹CentOS 7更新YUM來源步驟,希望對需要的朋友有幫助!

國內小夥伴推薦使用阿里雲的來源

Step1 找到需要的來源

阿里巴巴開源鏡像站各種來源應有盡有,舊網域是https://mirrors.aliyun.com/

Step2 編輯CentOS7.repo檔

#/etc/yum.repos.d

,發現我的來源還是

7.4.1708

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

[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&arch=$basearch&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&arch=$basearch&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&arch=$basearch&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&arch=$basearch&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&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

登入後複製
這個版本的來源已經遷移到

7.5.1804

了,→地址,使用VIM將其替換

    1

    :%s/7.4.1708/7.7.1908/g

    登入後複製
  • Step3 修復衝突報錯然後更新系統試試
  • yum -y update
  • <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">[root@liaogx ~]# yum -y update Plugin &quot;product-id&quot; can't be imported Plugin &quot;search-disabled-repos&quot; 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 --&gt; Running transaction check ---&gt; Package ModemManager.x86_64 0:1.6.0-2.el7 will be updated ......此处略...... ---&gt; Package yum-rhn-plugin.noarch 0:2.0.1-10.el7 will be installed --&gt; Running transaction check ---&gt; Package libbytesize.x86_64 0:1.2-1.el7 will be installed ---&gt; Package python2-pytoml.noarch 0:0.1.18-1.el7 will be installed ---&gt; Package volume_key-libs.x86_64 0:0.3.9-8.el7 will be installed --&gt; Processing Conflict: initscripts-9.49.41-1.el7_5.1.x86_64 conflicts redhat-release &lt; 7.5-0.11 --&gt; 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 &gt;= ('0', '1.6.4', '1') [root@liaogx ~]#</pre><div class="contentsignin">登入後複製</div></div>如果報如下錯誤
  • Error: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64

    這是更新軟體包是與原始版本衝突造成的,有兩種解決辦法

    透過關鍵字initscritps排除衝突:yum update --exclude=kernel* --exclude=centos-release* --exclude=initscripts*

    #刪除衝突套件:

    rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps
    #########這裡使用第二種方法,把衝突的套件幹掉###

    1

    2

    3

    4

    5

    6

    7

    [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 ~]#

    登入後複製
    ###Step4 更新系統######小白從入門到跑路必會,###sudo yum -y update###,老鳥都懂。 ###

    1

    2

    3

    4

    [root@liaogx ~]# yum -y update

    ......此处省略10分钟......

    Complete!

    [root@liaogx ~]#

    登入後複製
    ###更新成功 ^_^######

    以上是詳解CentOS7更新YUM來源步驟的詳細內容。更多資訊請關注PHP中文網其他相關文章!

    相關標籤:
    本網站聲明
    本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
    熱門教學
    更多>
    最新下載
    更多>
    網站特效
    網站源碼
    網站素材
    前端模板