zoukankan      html  css  js  c++  java
  • OS: Redhat8.4 更换网络源的方法

    redhat8.4 更换网络源的方法

     


    一、修改dnf插件配置:(/etc/dnf/plugins)

     

    1、本配置方法,redhat8.4能使用网络源,但无法关闭redhat8.4注册信息提示。在新安装的系统上(rhel-8.4-x86_64-dvd.iso),直接配置dnf相关文件。注意,千万不要卸载和重装dnf等相关软件。



    2.修改 subscription-manager.conf (/etc/dnf/plugins)

    2.1、修改前:
    [root@redhatos plugins]# cat subscription-manager.conf
    [main]
    enabled=1

    # When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
    # every time subscription-manager plugin is triggered by dnf or yum
    disable_system_repos=0

    2.2、修改后(将 "enabled=1" 修改为 "enabled=0" ):
    [root@redhatos plugins]# cat subscription-manager.conf
    [main]
    enabled=0

    # When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
    # every time subscription-manager plugin is triggered by dnf or yum
    disable_system_repos=0


    二、设置 dnf 网络源


    1、网络源内容(网络源文件名 = redhat84-163.repo):


    [root@redhatos config]# cat redhat84-163.repo
    # Redhat.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.
    #
    #

     


    [BaseOS]
    name=Redhat84 - 163 - Base
    baseurl=https://mirrors.163.com/centos/8-stream/BaseOS/x86_64/os/
    #baseurl=https://mirrors.163.com/centos/8.2.2004/BaseOS/x86_64/os/
    #mirrorlist=http://mirrorlist.centos.org/?release=8.2.2004&arch=x86_64&repo=BaseOS&infra=$infra
    enabled=1
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

     


    [AppStream]
    name=Redhat84 - 163 - AppStream
    baseurl=https://mirrors.163.com/centos/8-stream/AppStream/x86_64/os/
    #mirrorlist=http://mirrorlist.centos.org/?release=8.2.2004&arch=x86_64&repo=AppStream&infra=$infra
    enabled=1
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

     


    [PowerTools]
    name=Redhat84 - 163 - PowerTools
    baseurl=https://mirrors.163.com/centos/8-stream/PowerTools/x86_64/os/
    #mirrorlist=http://mirrorlist.centos.org/?release=8.2.2004&arch=x86_64&repo=PowerTools&infra=$infra
    enabled=0
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

     


    #additional packages that may be useful
    [extras]
    name=Redhat84 - 163 - Extras
    baseurl=https://mirrors.163.com/centos/8-stream/extras/x86_64/os/
    #mirrorlist=http://mirrorlist.centos.org/?release=8.2.2004&arch=x86_64&repo=extras
    enabled=1
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

     


    #additional packages that extend functionality of existing packages
    [centosplus]
    name=Redhat84 - 163 - Plus
    baseurl=https://mirrors.163.com/centos/8-stream/centosplus/x86_64/os/
    #mirrorlist=http://mirrorlist.centos.org/?release=8.2.2004&arch=x86_64&repo=centosplus
    gpgcheck=0
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

    [root@redhatos config]#

     


    2、更换网络源:
    [root@redhatos config]# cp redhat84-163.repo /etc/yum.repos.d/


    3、测试网络源:

    [root@redhatos config]# dnf clean all
    18 files removed
    [root@redhatos config]# dnf makecache
    Redhat84 - 163 - Base 8.5 MB/s | 2.7 MB 00:00
    Redhat84 - 163 - AppStream 18 MB/s | 8.5 MB 00:00
    Redhat84 - 163 - Extras 67 kB/s | 13 kB 00:00
    Last metadata expiration check: 0:00:01 ago on Fri 21 May 2021 04:26:05 PM CST.
    Metadata cache created.
    [root@redhatos config]# dnf grouplist
    Last metadata expiration check: 0:00:12 ago on Fri 21 May 2021 04:26:05 PM CST.
    Available Environment Groups:
    Server with GUI
    Server
    Minimal Install
    Custom Operating System
    Virtualization Host
    Installed Environment Groups:
    Workstation
    Installed Groups:
    Development Tools
    Available Groups:
    Legacy UNIX Compatibility
    Container Management
    .NET Core Development
    Graphical Administration Tools
    Headless Management
    Network Servers
    RPM Development Tools
    Scientific Support
    Security Tools
    Smart Card Support
    System Tools
    [root@redhatos config]#

     


    三、参考资料:

    1、redhat8.0 更改yum源        https://blog.csdn.net/peal1/article/details/114886257

    本文由lnlidawei(https://www.cnblogs.com/lnlidawei)原创或整理,转载请注明出处。
  • 相关阅读:
    Python NLP入门教程
    一个月入门Python爬虫,轻松爬取大规模数据
    Python爬虫实战案例:爬取爱奇艺VIP视频
    探索Python F-strings是如何工作
    Ruby 和 Python 分析器是如何工作的?
    超级干货,python常用函数大总结
    Python 开发者的 6 个必备库,你都了解吗?
    神经网络中 BP 算法的原理与 Python 实现源码解析
    新手程序员必学的代码编程技巧
    零基础小白怎么用Python做表格?
  • 原文地址:https://www.cnblogs.com/lnlidawei/p/14794454.html
Copyright © 2011-2022 走看看