Linux_centos 3.10.0-514.26.2.el7.x86_64(centos7)报错:yum list 正常,yum 安装无法使用的解决方法
一、出错情况
(1)yum list可以查出数来,证明ISO系统镜像是关联了的且挂载成功:
yum list
(2)yum repolist显示仓库的时候是0:
yum repolist
(3)总结原因:问题应该出在了.repo文件上了。
cd /etc/yum.repos.d
ll
二、解决方法
(1)查看是否已经安装了yum工具:
rpm -qa | grep yum
没有安装,点击查看百度经验进行安装:linux 怎么安装yum
(2)CentOS 报错:There are no enabled repos
①报错情况:
yum grouplist
②解决方法,输入命令:
cd ~
cd /etc/yum.repos.d
ll
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
③ 下载对应版本repo文件:(此处系统:腾讯云centos7 )
(1)把/etc/yum.repos.d/下面所有的源给删除掉了
(2)下载镜像命令:
- CentOS 5 命令: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
- CentOS 6命令: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
- CentOS 7命令: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 注意如果没有安装wget,可以从下面的网址中先手动下载,然后上传到linux上安装: http://www.rpmfind.net/linux/rpm2html/search.php?query=wget
④ 此时/etc/yum.repos.d/中CentOS-Base.repo源已更新。如果,虚机网络没问题则可以下载软件包了
⑤运行以下命令生成缓存:
yum clean all
yum makecache
⑥验证问题是否解决,输入命令:
yum repolist
资料参考网址:https://cloud.tencent.com/developer/article/1398972 。