安装好CentOS后,使用yum安装报错 转载
mob604756f976e62021-03-09 19:09:00
文章标签Linuxcentosyum源加载清理缓存文章分类其它其它阅读数141
安装好CentOS后,使用yum安装报错
安装好CenOS7后,自带的yum不能直接使用,使用会出现如下问题:t
已加载插件:fastestmirror, langpacks File contains no section headers.
已加载插件:fastestmirror, langpacks
http://mirrors.aliyun.com/centos/7.8.2003/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below wiki article
1.
2.
3.
4.
5.
6.
报出404的错误
安装好CentOS后,使用yum安装报错_Linux
第一种:更改yum源
原因是没有配置yum源,修改/etc/yum.repos.d/CenOS-Base.repo文件内容如下:
[base]
name=CentOS- r e l e a s e v e r − B a s e m i r r o r l i s t = h t t p : / / m i r r o r l i s t . c e n t o s . o r g / ? r e l e a s e = releasever - Base mirrorlist=http://mirrorlist.centos.org/?release= releasever−Basemirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=os&infra=infra
#baseurl=http://mirror.centos.org/centos/ r e l e a s e v e r / o s / releasever/os/ releasever/os/basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS- r e l e a s e v e r − U p d a t e s m i r r o r l i s t = h t t p : / / m i r r o r l i s t . c e n t o s . o r g / ? r e l e a s e = releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release= releasever−Updatesmirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=updates&in…infra
#baseurl=http://mirror.centos.org/centos/ r e l e a s e v e r / u p d a t e s / releasever/updates/ releasever/updates/basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS- r e l e a s e v e r − E x t r a s m i r r o r l i s t = h t t p : / / m i r r o r l i s t . c e n t o s . o r g / ? r e l e a s e = releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release= releasever−Extrasmirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=extras&inf…infra
#baseurl=http://mirror.centos.org/centos/ r e l e a s e v e r / e x t r a s / releasever/extras/ releasever/extras/basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS- r e l e a s e v e r − P l u s m i r r o r l i s t = h t t p : / / m i r r o r l i s t . c e n t o s . o r g / ? r e l e a s e = releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release= releasever−Plusmirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=centosplus…infra
#baseurl=http://mirror.centos.org/centos/ r e l e a s e v e r / c e n t o s p l u s / releasever/centosplus/ releasever/centosplus/basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
第二种:删除原有yum文件
如果不行,这样,删除原有的文件:
rm -f /etc/yum.repos.d/CentOS-Base.repo
1.
然后重新下载阿里的:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1.
清理缓存:
yum clean all
1.
第三种:删除所有yum文件
ps:如果上述方法没有解决,尝试下面:
删除yum.repos.d目录下所有文件
rm -f /etc/yum.repos.d/*
1.
然后重新下载阿里的:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1.
清理缓存:
yum clean all
1.
测试下载安装:
yum install gcc
1.
愿路途漫长,以后莫失莫忘。 愿你不骄不躁,安稳顺心。
归档:我的知识栈:目录(更新中…)
作者:菜鸟-传奇