本文主要是介绍CentOS8系统配置国内yum源,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 首先进入/etc/yum.repos.d/目录下,新建一个repo_bak目录,用于保存系统中原来的repo文件
[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
2. 在CentOS中配置使用网易和阿里的开源镜像
到阿里开源镜像站点下载系统对应版本的repo文件.
#CentOS8
[root@bogon yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-8.repo
3. 配置清华源Centos8
$ vi /etc/yum.repos.d/CentOS-cnnic.repo#清华源如下配置,这里centosplus-cnnic和PowerTools-cnnic中的enabled根据需求打开;
[BaseOS-cnnic]
name=CentOS-$releasever-Base-cnnic
baseurl=https://mirrors.cnnic.cn/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official[AppStream-cnnic]
name=CentOS-$releasever-AppStream-cnnic
baseurl=https://mirrors.cnnic.cn/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official[extras-cnnic]
name=CentOS-$releasever-Extras-cnnic
baseurl=https://mirrors.cnnic.cn/centos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official[centosplus-cnnic]
name=CentOS-$releasever-Plus-cnnic
baseurl=https://mirrors.cnnic.cn/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official[PowerTools-cnnic]
name=CentOS-$releasever-PowerTools-cnnic
baseurl=https://mirrors.cnnic.cn/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.cnnic.cn/centos/RPM-GPG-KEY-CentOS-Official
4.清除系统yum缓存,并重新生成新的yum缓存
dnf -y install epel-release
dnf clean all
dnf makecache
dnf repolist
这篇关于CentOS8系统配置国内yum源的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!