redhat8换源
参考文档:https://www.cnblogs.com/xingkan/articles/6919997.html
----换源思路:
因为redhat8和centos8是同款软件,所以使用的源也必然相同。因此,centos8的源,也是redhat8的源。
----换源操作:删除原来的redhat8的dnf软件,换成centos的dnf软件。
1.检查redhat8是否安装dnf软件包
----rpm -qa | grep dnf
----rpm -qa | grep dnf > dnf.txt (记住已经安装的dnf软件,这些软件将来还要重新安装)
2.删除redhat8自带的dnf软件包
rpm -qa | grep dnf | xargs rpm -e --nodeps
3.查看redhat8的dnf软件包是否删除干净
rpm -qa | grep dnf
4.下载centos8的dnf
----网址:http://mirrors.163.com/centos/8/AppStream/x86_64/os/Packages/)
----下载dnf软件包(参考dnf.txt文档内容,dnf相关的软件都下载下来吧)
5.在redhat8上安装dnf软件包
----安装命令: rpm -ivh * --force --nodeps
----共计10款软件,内容如下:
python3-libdnf-0.22.5-4.el8.x86_64
dnf-4.0.9.2-5.el8.noarch
dnf-automatic-4.0.9.2-5.el8.noarch
python3-dnf-4.0.9.2-5.el8.noarch
python3-dnf-plugin-versionlock-4.0.2.2-3.el8.noarch
dnf-utils-4.0.2.2-3.el8.noarch
libdnf-0.22.5-4.el8.x86_64
python3-dnf-plugins-core-4.0.2.2-3.el8.noarch
dnf-plugins-core-4.0.2.2-3.el8.noarch
dnf-data-4.0.9.2-5.el8.noarch
6.配置源redhat.repo
##redhat.repo
# for redhat8 dnf
#
#
#
#
#
#
#
#
# http://mirrors.163.com/centos/8/
# http://mirrors.163.com/centos/8/cr/x86_64/os/
[BaseOS]
name=Redhat-8 - Base
baseurl=http://mirrors.163.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[AppStream]
name=Redhat-8 - AppStream
baseurl=http://mirrors.163.com/centos/8/AppStream/x86_64/os/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[extras]
name=Redhat-8 - Extras
baseurl=http://mirrors.163.com/centos/8/extras/x86_64/os/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[centosplus]
name=Redhat-8 - Plus
baseurl=http://mirrors.163.com/centos/8/centosplus/x86_64/os/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[fasttrack]
name=Redhat-8 - fasttrack
baseurl=http://mirrors.163.com/centos/8/fasttrack/x86_64/os/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[PowerTools]
name=Redhat-8 - PowerTools
baseurl=http://mirrors.163.com/centos/8/PowerTools/x86_64/os/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
7.复制redhat.repo文件到路径"/etc/yum.repos.d/"
cp redhat.repo /etc/yum.repos.d/
8.测试dnf,命令如下:
dnf clean all
dnf makecache
9.注意事项:
--redhat.repo仓库的开启,需要将“enabled=0”改为“enabled=1”。