zoukankan      html  css  js  c++  java
  • [centos][yum] centos升级到特定版本

    我们已知,yum upgrade命令可以将整个系统升级到最新版本。

    但是很多时候,我们需要更新到指定版本,比如,当前最新的CentOS版本是7.6.1810

    但是我需要更新到7.4,可以如下这样做:

    1.  CentOS的repo是不维护历史版本的。所有历史版本都在这里,

    http://vault.centos.org/

    在OS里,有这样的一个repo, /etc/yum.repos.d/CentOS-Vault.repo

    里边是,当前版本之前的历史版本。所以里边没有7.4 。

    2.  更新centos-release包,拿到7,4的vault

    yum install centos-release

    3  查看所有可用的repo

    yum repolist all

    详见:

    repo id                                                                                              repo name                                                                                                                                status
    C7.0.1406-base/x86_64                                                                                CentOS-7.0.1406 - Base                                                                                                                   disabled
    C7.0.1406-centosplus/x86_64                                                                          CentOS-7.0.1406 - CentOSPlus                                                                                                             disabled
    C7.0.1406-extras/x86_64                                                                              CentOS-7.0.1406 - Extras                                                                                                                 disabled
    C7.0.1406-fasttrack/x86_64                                                                           CentOS-7.0.1406 - Fasttrack                                                                                                              disabled       
    C7.0.1406-updates/x86_64                                                                             CentOS-7.0.1406 - Updates                                                                                                                disabled       
    C7.1.1503-base/x86_64                                                                                CentOS-7.1.1503 - Base                                                                                                                   disabled       
    C7.1.1503-centosplus/x86_64                                                                          CentOS-7.1.1503 - CentOSPlus                                                                                                             disabled       
    C7.1.1503-extras/x86_64                                                                              CentOS-7.1.1503 - Extras                                                                                                                 disabled       
    C7.1.1503-fasttrack/x86_64                                                                           CentOS-7.1.1503 - Fasttrack                                                                                                              disabled       
    C7.1.1503-updates/x86_64                                                                             CentOS-7.1.1503 - Updates                                                                                                                disabled       
    C7.2.1511-base/x86_64                                                                                CentOS-7.2.1511 - Base                                                                                                                   disabled       
    C7.2.1511-centosplus/x86_64                                                                          CentOS-7.2.1511 - CentOSPlus                                                                                                             disabled       
    C7.2.1511-extras/x86_64                                                                              CentOS-7.2.1511 - Extras                                                                                                                 disabled       
    C7.2.1511-fasttrack/x86_64                                                                           CentOS-7.2.1511 - Fasttrack                                                                                                              disabled       
    C7.2.1511-updates/x86_64                                                                             CentOS-7.2.1511 - Updates                                                                                                                disabled
    C7.3.1611-base/x86_64                                                                                CentOS-7.3.1611 - Base                                                                                                                   disabled       
    C7.3.1611-centosplus/x86_64                                                                          CentOS-7.3.1611 - CentOSPlus                                                                                                             disabled      
    C7.3.1611-extras/x86_64                                                                              CentOS-7.3.1611 - Extras                                                                                                                 disabled      
    C7.3.1611-fasttrack/x86_64                                                                           CentOS-7.3.1611 - Fasttrack                                                                                                              disabled      
    C7.3.1611-updates/x86_64                                                                             CentOS-7.3.1611 - Updates                                                                                                                disabled      
    C7.4.1708-base/x86_64                                                                                CentOS-7.4.1708 - Base                                                                                                                   disabled      
    C7.4.1708-centosplus/x86_64                                                                          CentOS-7.4.1708 - CentOSPlus                                                                                                             disabled
    C7.4.1708-extras/x86_64                                                                              CentOS-7.4.1708 - Extras                                                                                                                 disabled
    C7.4.1708-fasttrack/x86_64                                                                           CentOS-7.4.1708 - Fasttrack                                                                                                              disabled
    C7.4.1708-updates/x86_64                                                                             CentOS-7.4.1708 - Updates                                                                                                                disabled
    C7.5.1804-base/x86_64                                                                                CentOS-7.5.1804 - Base                                                                                                                   disabled
    C7.5.1804-centosplus/x86_64                                                                          CentOS-7.5.1804 - CentOSPlus                                                                                                             disabled
    C7.5.1804-extras/x86_64                                                                              CentOS-7.5.1804 - Extras                                                                                                                 disabled
    C7.5.1804-fasttrack/x86_64                                                                           CentOS-7.5.1804 - Fasttrack                                                                                                              disabled
    C7.5.1804-updates/x86_64                                                                             CentOS-7.5.1804 - Updates                                                                                                                disabled
    C7.6.1810-base/x86_64                                                                                CentOS-7.6.1810 - Base                                                                                                                   disabled
    C7.6.1810-centosplus/x86_64                                                                          CentOS-7.6.1810 - CentOSPlus                                                                                                             disabled
    C7.6.1810-extras/x86_64                                                                              CentOS-7.6.1810 - Extras                                                                                                                 disabled
    C7.6.1810-fasttrack/x86_64                                                                           CentOS-7.6.1810 - Fasttrack                                                                                                              disabled
    C7.6.1810-updates/x86_64                                                                             CentOS-7.6.1810 - Updates                                                                                                                disabled
    base/7/x86_64                                                                                        CentOS-7 - Base                                                                                                                          enabled: 10,097
    base-debuginfo/x86_64                                                                                CentOS-7 - Debuginfo                                                                                                                     enabled:  7,293
    base-source/7                                                                                        CentOS-7 - Base Sources                                                                                                                  enabled:      0
    !c7-media                                                                                            CentOS-7 - Media                                                                                                                         disabled
    centosplus/7/x86_64                                                                                  CentOS-7 - Plus                                                                                                                          disabled
    centosplus-source/7                                                                                  CentOS-7 - Plus Sources                                                                                                                  enabled:      0
    cr/7/x86_64                                                                                          CentOS-7 - cr                                                                                                                            disabled
    epel/x86_64                                                                                          Extra Packages for Enterprise Linux 7 - x86_64                                                                                           enabled: 13,485
    epel-debuginfo/x86_64                                                                                Extra Packages for Enterprise Linux 7 - x86_64 - Debug                                                                                   disabled
    !epel-source/x86_64                                                                                  Extra Packages for Enterprise Linux 7 - x86_64 - Source                                                                                  disabled
    epel-testing/x86_64                                                                                  Extra Packages for Enterprise Linux 7 - Testing - x86_64                                                                                 disabled
    epel-testing-debuginfo/x86_64                                                                        Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug                                                                         disabled
    epel-testing-source/x86_64                                                                           Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source                                                                        disabled
    extras/7/x86_64                                                                                      CentOS-7 - Extras                                                                                                                        enabled:    305
    extras-source/7                                                                                      CentOS-7 - Extras Sources                                                                                                                enabled:      0
    fasttrack/7/x86_64                                                                                   CentOS-7 - fasttrack                                                                                                                     disabled
    updates/7/x86_64                                                                                     CentOS-7 - Updates                                                                                                                       enabled:    953
    updates-source/7                                                                                     CentOS-7 - Updates Sources                                                                                                               enabled:      0
    repolist: 32,133
    View Code

    4 清空缓存

    yum clean all
    rm -f /var/cache/yum

    5 安装更新

    通过对3中repo id的查询,可用使用如下命令,进行全局更新到指定版本

    yum --disablerepo='*' --enablerepo='C7.4*' upgrade

    6 更新指定软件

    yum --disablerepo='*' --enablerepo='C7.4*,epel' update kernel

    7 回到正确的release

    centos-release是版本标识,我们应该始终保持它指示着正确的信息。

    将centos-release包降级回7.4, 之后所有的默认repo便都指向了7.4。

    yum --disablerepo="*" --enablerepo="C7.4.1708-*" --enablerepo="epel*" downgrade centos-release

    8 常见问题

    8.1

    Error:  Multilib version problems found. This often means that the root
           cause is something else and multilib version checking is just
           pointing out that there is a problem. Eg.:
           
             1. You have an upgrade for systemd-libs which is missing some
                dependency that another package requires. Yum is trying to
                solve this by installing an older version of systemd-libs of the
                different architecture. If you exclude the bad architecture
                yum will tell you what the root cause is (which package
                requires what). You can try redoing the upgrade with
                --exclude systemd-libs.otherarch ... this should give you an error
                message showing the root cause of the problem.
           
             2. You have multiple architectures of systemd-libs installed, but
                yum can only see an upgrade for one of those architectures.
                If you don't want/need both architectures anymore then you
                can remove the one with the missing update and everything
                will work.
           
             3. You have duplicate versions of systemd-libs installed already.
                You can use "yum check" to get yum show these errors.
           
           ...you can also use --setopt=protected_multilib=false to remove
           this checking, however this is almost never the correct thing to
           do as something else is very likely to go wrong (often causing
           much more problems).
           
           Protected multilib versions: systemd-libs-219-42.el7_4.10.i686 != systemd-libs-219-57.el7.x86_64
    Error: Protected multilib versions: elfutils-libs-0.168-8.el7.i686 != elfutils-libs-0.170-4.el7.x86_64
    Error: Protected multilib versions: libselinux-2.5-11.el7.i686 != libselinux-2.5-14.1.el7.x86_64
    Error: Protected multilib versions: elfutils-libelf-0.168-8.el7.i686 != elfutils-libelf-0.170-4.el7.x86_64
    Error: Protected multilib versions: pam-1.1.8-18.el7.i686 != pam-1.1.8-22.el7.x86_64
    Error: Protected multilib versions: nss-softokn-freebl-3.28.3-8.el7_4.i686 != nss-softokn-freebl-3.36.0-5.el7_5.x86_64
    Error: Protected multilib versions: libsepol-2.5-6.el7.i686 != libsepol-2.5-10.el7.x86_64

    没有解决。。。

  • 相关阅读:
    求列表中指定元素的位置
    Hash_P1026毒药?解药?
    Hash_集合
    bzoj1483: [HNOI2009]梦幻布丁
    bzoj1724: [Usaco2006 Nov]Fence Repair 切割木板
    容斥原理
    bzoj1042: [HAOI2008]硬币购物
    [Noi2016十连测第五场]二进制的世界
    NOI2016模拟赛Zbox loves stack
    bzoj2038: [2009国家集训队]小Z的袜子(hose)
  • 原文地址:https://www.cnblogs.com/hugetong/p/11991702.html
Copyright © 2011-2022 走看看