Centos 8 配置yum源
来自CloudWiki
背景
Linux服务器CentOS 8版本操作系统执行宝塔安装命令报错如下图:
Error: Failed to download metadata for repo 'epel' Errors during downloading metadata for repository 'epel': - Status code: 404 for http://archives.fedoraproject.org/pub/archive/epel/8/Everything/x86_64/repodata/repomd.xml (IP: 38.145.60.24) Error: Failed to download metadata for repo 'epel': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
原因:第三方的镜像站中均已移除CentOS 8的源,Centos 8版本已停止更新相应依赖导致的,下载新的yum源即可搞定。
备份yum源
mv /etc/yum.repos.d /etc/yum.repos.d.bak
新建yum源
mkdir -p /etc/yum.repos.d
curl https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo > /etc/yum.repos.d/Centos-vault-8.5.2111.repo
curl https://mirrors.aliyun.com/repo/epel-archive-8.repo > /etc/yum.repos.d/epel-archive-8.repo
清除缓存
yum clean all
yum makecache
安装软件
yum -y install python-devel
如果上面这个命令不成功,则执行下面这个:
yum install python36-devel