问题 手上有一台Centos8的服务器,使用一件脚本安装宝塔面板时,报以下错误
仔细看了下文档,原因主要是 2022年1月31日,CentOS团队从官方镜像中移除了CentOS 8的所有包,停止支持、如需安装建议更换Centos7系统或升级至Centos 8 Stream系统安装宝塔 继续使用8的话,可以替换成腾讯的镜像 腾讯yum源
替换yum源
腾云yum源: https://mirrors.tencent.com/help/centos.html
代码语言:javascript复制[root@VM-0-5-centos rpm]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo
--2022-03-07 13:28:46-- http://mirrors.cloud.tencent.com/repo/centos8_base.repo
Resolving mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)... 101.33.27.49, 101.33.26.180, 101.33.27.51, ...
Connecting to mirrors.cloud.tencent.com (mirrors.cloud.tencent.com)|101.33.27.49|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1792 (1.8K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
/etc/yum.repos.d/CentOS-Base.repo 100%[==============================================================================>] 1.75K --.-KB/s in 0s
2022-03-07 13:28:46 (200 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [1792/1792]
清理yum缓存 & 建立新缓存 清理缓存
代码语言:javascript复制[root@VM-0-5-centos rpm]# yum clean all
建立新缓存
代码语言:javascript复制
[root@VM-0-5-centos rpm]# yum makecache
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Repository extras is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
Qcloud centos OS - x86_64 978 kB/s | 4.6 MB 00:04
Qcloud centos extras - x86_64 6.4 kB/s | 10 kB 00:01
EPEL for redhat/centos 8 - x86_64 7.6 MB/s | 11 MB 00:01
CentOS Linux 8 - AppStream 78 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
发现又有之前的问题,makecache报错 makache报错解决 CentOS8的yum.repos.d中,有CentOS-AppStream.repo、CentOS-Linux-Base.repo、CentOS-Linux-AppStream.repo这些文件,这些文件的源没有被替换,因此需要手动替换下这些文件源。 先看下正确的配置方式,即CentOS-Base.repo的配置
代码语言:javascript复制
[root@VM-0-5-centos rpm]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[BaseOS]
name=Qcloud centos OS - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[centosplus]
name=Qcloud centosplus - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/centosplus/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[extras]
name=Qcloud centos extras - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[fasttrack]
name=Qcloud centos fasttrack - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/fasttrack/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[AppStream]
name=Qcloud centos AppStream - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
[PowerTools]
name=Qcloud centos PowerTools - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/PowerTools/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
将[AppStream]的配置粘贴到【CentOS-AppStream.repo】以及【CentOS-Linux-AppStream.repo】中,并将改文件的所有内容,粘贴到【CentOS-Linux-Base.repo】 重新运行makechche
代码语言:javascript复制
[root@VM-0-5-centos yum.repos.d]# yum makecache
Repository AppStream is listed more than once in the configuration
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Repository AppStream is listed more than once in the configuration
Repository BaseOS is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
Qcloud centos OS - x86_64 2.3 kB/s | 3.9 kB 00:01
Qcloud centos extras - x86_64 963 B/s | 1.5 kB 00:01
EPEL for redhat/centos 8 - x86_64 48 kB/s | 4.7 kB 00:00
Metadata cache created.
成功 安装宝塔面板 最后,运行官方的安装脚本即可
代码语言:javascript复制[root@VM-0-5-centos yum.repos.d]# yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
参考 完美解决CentOS8 yum安装AppStream报错,更新yum后无法makecache的问题 - 白_胖_子 - 博客园