Centos 中在使用 yum install 时候报错解决
1.错误:在"/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d"中没有被启用的仓库
报错如下图
查资料得知为Centos 的原件源仓库配置文件错误
https://wenku.csdn.net/answer/eb4a07cfcd4695229e1a8ea840bf3317
配置文件为 /etc/yum.repos.d/CentOS-Base.repo
2.获取正确的源仓库配置文件
其中 http://mirrors.aliyun.com/repo/Centos-7.repo 为阿里云仓库中配置文件地址。 根据本地系统版本,选择Centos-7.repo
我是在http://mirrors.aliyun.com/直接下载到本地电脑 再复制到 /etc/yum.repos.d/文件目录中
[grok@localhost Desktop]$ ftp 10.0.4.6
Connected to 10.0.4.6 (10.0.4.6).
220-Wellcome to Home Ftp Server!
220 Server ready.
Name (10.0.4.6:grok): grok
331 Password required for grok.
Password:
230 User grok logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bin
200 Type set to I.
ftp> lcd /home/grok/Desktop/
Local directory now /home/grok/Desktop
ftp> dir
227 Entering Passive Mode (10,0,4,6,14,122).
150 Opening data connection for directory list.
drw-rw-rw- 1 ftp ftp 0 Nov 20 11:02 .
drw-rw-rw- 1 ftp ftp 0 Nov 20 11:02 ..
-rw-rw-rw- 1 ftp ftp 2590 Nov 20 11:00 Centos-8.repo
-rw-rw-rw- 1 ftp ftp 731 Nov 18 19:27 CentOS-AppStream.repo
226 File sent ok
ftp> get Centos-8.repo
local: Centos-8.repo remote: Centos-8.repo
227 Entering Passive Mode (10,0,4,6,14,136).
150 Opening data connection for Centos-8.repo.
226 File sent ok
2590 bytes received in 3.3e-05 secs (78484.85 Kbytes/sec)
ftp> get CentOS-Appstream.repo
local: CentOS-Appstream.repo remote: CentOS-Appstream.repo
227 Entering Passive Mode (10,0,4,6,14,196).
150 Opening data connection for CentOS-Appstream.repo.
226 File sent ok
731 bytes received in 0.000784 secs (932.40 Kbytes/sec)
ftp> bye
221 Goodbye.
[grok@localhost Desktop]$ sudo mv /home/grok/Desktop/Centos-8.repo /etc/yum.repos.d/CentOS-Base.repo
[grok@localhost Desktop]$ cd /etc/yum.repos.d
[grok@localhost yum.repos.d]$ ll -h
总用量 16K
-rw-r--r--. 1 root root 2.6K 8月 4 2022 Centos-Base-repo
-rw-rw-r--. 1 grok grok 2.6K 11月 20 13:40 CentOS-Base.repo
-rw-r--r--. 1 root root 567 11月 18 18:57 CentOS-base.repos
drwxr-xr-x. 2 root root 4.0K 6月 12 17:54 yum.repos.d.bak
3.使用yum 测试下载正常。
[grok@localhost yum.repos.d]$ sudo yum install vsftpd
CentOS-8 - Base - mirrors.aliyun.com 2.3 MB/s | 4.6 MB 00:02
CentOS-8 - Extras - mirrors.aliyun.com 15 kB/s | 10 kB 00:00
CentOS-8 - AppStream - mirrors.aliyun.com 1.0 MB/s | 8.4 MB 00:08
依赖关系解决。
==============================================================================================================================
软件包 架构 版本 仓库 大小
==============================================================================================================================
安装:
vsftpd x86_64 3.0.3-34.el8 AppStream 181 k
事务概要
==============================================================================================================================
安装 1 软件包
总下载:181 k
安装大小:347 k