问题描述:
使用yum无法下载
[root@localhost my]# yum install ntp
Error: There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d".
解决方法:
①检查网络连接
检查虚拟机是否能连接到互联网,肯定要联网才能使用,随便ping一下检查一下:
[root@localhost ~]# ping www.baidu.com
②检查yum的配置
根据错误提示查看文件“/etc/yum.repos.d”
[root@localhost ~]# ls /etc/yum.repos.d
openEuler_x86_64.repo
查看仓库
[root@localhost ~]# cat /etc/yum.repos.d/openEuler_x86_64.repo
发现里面是空的,只有注释,往里面添加配置
[root@localhost ~]# vim /etc/yum.repos.d/openEuler_x86_64.repo
以下是openEuler-20.03-LTS版本的配置文件:
[openEuler-source]
name=openEuler-source
baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=https://repo.openeuler.org/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler
[openEuler-os]
name=openEuler-os
baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/OS/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://repo.openeuler.org/openEuler-20.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler
[openEuler-everything]
name=openEuler-everything
baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/everything/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://repo.openeuler.org/openEuler-20.03-LTS/everything/x86_64/RPM-GPG-KEY-openEuler
[openEuler-EPOL]
name=openEuler-epol
baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/EPOL/x86_64/
enabled=1
gpgcheck=0
[openEuler-update]
name=openEuler-update
baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/update/x86_64/
enabled=1
gpgcheck=0
保存后,更新缓存即可:
[root@localhost ~]# yum makecache
[root@localhost ~]# yum update
现在yum就能正常使用了
其他版本:
不同版本的配置文件都是一样的,只是里面的baseurl的值不一样,baseurl的值是对应版本的官网地址。官网地址:https://repo.openeuler.org/,在官网中找到你虚拟机对应的版本即可。
例如20.03的版本网址是:https://repo.openeuler.org/openEuler-20.03-LTS/