在使用最小安装Centos7后,刚进入系统什么都没做,yum直接报错:
[root@localhost ~]# yum install wget -y
Loaded plugins: fastestmirror
Determining fastest mirrors
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>
在更改了fastestmirror.conf和yum.conf这两个文件后报错变成了:
更改:将第一个文件中的enabled改成0,第二个文件中的plugins改成0
[root@localhost ~]# vi /etc/yum/pluginconf.d/fastestmirror.conf
[root@localhost ~]# vi /etc/yum.conf
[root@localhost ~]# yum clean all
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>
之后发现原因是:缺少CentOS-Base.repo文件
下载地址:http://mirrors.163.com/.help/CentOS7-Base-163.repo
下载后放入/etc/yum.repos.d/文件夹中
由于rz命令无法使用,故使用xftp上传
上传完成后执行:
yum clean all
yum makecache
执行效果如下:
[root@localhost yum.repos.d]# yum clean all
Cleaning repos: base extras updates
[root@localhost yum.repos.d]# yum makecache
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/10): base/7/x86_64/filelists_db | 7.2 MB 00:00:02
(3/10): base/7/x86_64/primary_db | 6.1 MB 00:00:01
(4/10): extras/7/x86_64/primary_db | 250 kB 00:00:00
(5/10): extras/7/x86_64/filelists_db | 303 kB 00:00:01
(6/10): base/7/x86_64/other_db | 2.6 MB 00:00:01
(7/10): extras/7/x86_64/other_db | 150 kB 00:00:00
(8/10): updates/7/x86_64/filelists_db | 12 MB 00:00:06
(9/10): updates/7/x86_64/other_db | 1.4 MB 00:00:00
(10/10): updates/7/x86_64/primary_db | 22 MB 00:00:10
Metadata Cache Created
大功告成!