【问题标题】:how to enable repo with yum-config-manager --enable<repo>如何使用 yum-config-manager --enable<repo> 启用 repo
【发布时间】:2020-03-08 03:59:21
【问题描述】:

在尝试安装 yum-utils 的过程中,我遇到了似乎没有启用 repos 的问题。当我似乎需要他这样做时,如何启用yum-config-manager

[root@spectrumscale ~]# yum install yum-utils
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>

【问题讨论】:

    标签: yum


    【解决方案1】:

    要从特定仓库安装特定包,您可以使用

    yum install --enablerepo=name-of-repo name-of-package
    

    假设版本之间可能存在冲突,考虑安装 mariadb 5.5.66 的示例,在我的情况下,我有 2 个 repo mariadb-5mariadb-10,假设如果我想从 mariadb-5 repo 安装,那么我使用

    yum install --disablerepo=mariadb-10  --enablerepo=mariadb-5  MariaDB-server MariaDB-client
    

    要启用特定的 repo,您​​可以使用

    yum-config-manager --enable name-of-repo
    

    这是Centos 7.7上的示例

    [root@localhost server-setup]# cat /etc/redhat-release 
    CentOS Linux release 7.7.1908 (Core)
    
    [root@localhost server-setup]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.piconets.webwerks.in
     * epel: mirror.poliwangi.ac.id
     * extras: mirrors.piconets.webwerks.in
     * remi-safe: mirror.innosol.asia
     * updates: mirrors.piconets.webwerks.in
    repo id                                               repo name                                                                                        status
    CodeIT/x86_64                                         CodeIT repo                                                                                         369
    base/7/x86_64                                         CentOS-7 - Base                                                                                  10,097
    epel/x86_64                                           Extra Packages for Enterprise Linux 7 - x86_64                                                   13,453
    extras/7/x86_64                                       CentOS-7 - Extras                                                                                   305
    ius/x86_64                                            IUS for Enterprise Linux 7 - x86_64                                                                 641
    mariadb-10                                            MariaDB                                                                                              94
    mariadb-5                                             MariaDB                                                                                              39
    remi-safe                                             Safe Remi's RPM repository for Enterprise Linux 7 - x86_64                                        3,621
    updates/7/x86_64                                      CentOS-7 - Updates                                                                                  711
    repolist: 29,330
    

    禁用

    [root@localhost server-setup]# yum-config-manager --disable mariadb-5
    

    禁用后

    [root@localhost server-setup]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.piconets.webwerks.in
     * epel: mirror.poliwangi.ac.id
     * extras: mirrors.piconets.webwerks.in
     * remi-safe: mirror.innosol.asia
     * updates: mirrors.piconets.webwerks.in
    repo id                                               repo name                                                                                        status
    CodeIT/x86_64                                         CodeIT repo                                                                                         369
    base/7/x86_64                                         CentOS-7 - Base                                                                                  10,097
    epel/x86_64                                           Extra Packages for Enterprise Linux 7 - x86_64                                                   13,453
    extras/7/x86_64                                       CentOS-7 - Extras                                                                                   305
    ius/x86_64                                            IUS for Enterprise Linux 7 - x86_64                                                                 641
    mariadb-10                                            MariaDB                                                                                              94
    remi-safe                                             Safe Remi's RPM repository for Enterprise Linux 7 - x86_64                                        3,621
    updates/7/x86_64                                      CentOS-7 - Updates                                                                                  711
    repolist: 29,291
    

    它实际上做了什么???

    我在/etc/yum.repos.d/得到MariaDB.repo文件,当你使用--enable &lt;repo-name&gt;--disable &lt;repo-name&gt;时,它会将enabled =的值更改为01,基于此,yum repolist将向您显示存储库。

    [root@localhost server-setup]# cat /etc/yum.repos.d/MariaDB.repo 
    [mariadb-10]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.4.10/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1
    [mariadb-5]
    name = MariaDB
    baseurl = http://yum.mariadb.org/5.5.66/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1
    enabled = 1
    

    【讨论】:

    • [root@xiaojguan]# yum-config-manager --enable docker-ce-stable/7/x86_64 Failed to set locale, defaulting to C Loaded plugins: fastestmirror
    • 消息到底是什么?似乎包裹glibc-langpack-en 不见了?可能是yum reinstall glibc-langpack-en
    猜你喜欢
    • 2023-03-06
    • 2021-02-28
    • 1970-01-01
    • 1970-01-01
    • 2012-12-10
    • 1970-01-01
    • 1970-01-01
    • 2019-07-24
    • 1970-01-01
    相关资源
    最近更新 更多