起因
之前也写了一篇类似的文章,但感觉有漏洞,这次想直接把漏洞补齐。
问题描述
在我们新装的Centos7中,如果想要用C++编程,那就必须要用到yum下载,但是,很多新手,包括我使用yum下载就会遇到一个问题,当我们输入以下命令时:
yum -y install gcc*
就会报以下错误:
[root@wjx yum.repos.d]# yum grouplist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable <repo>
To enable custom repositories:
yum-config-manager --enable <repo>
大致意思是镜像不可用。
可能是因为最近,也就是2024年Centos官方停止更新了Centos,所以外国的yum也跟着会受到影响吧。下面网址是阿里云官方的镜像网,我的解决办法也是在这里面找的: