lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

 

posted on 2021-05-21 16:41  lnlidawei  阅读(966)  评论(0编辑  收藏  举报