完美解决CentOS8 yum安装AppStream报错

在CentOS8系统中,尝试通过yum安装httpd、mariadb、php和php-mysql等软件时遇到AppStream仓库下载失败的错误。首先检查网络连接和DNS解析正常,然后尝试更换为国内的yum源,如阿里云或腾讯云的CentOS8基础镜像源,并清理及更新yum缓存。然而,问题依然存在,AppStream仓库的下载 metadata 未能成功获取。
摘要由CSDN通过智能技术生成

CentOS 8 yum安装软件时,提示无法从AppStream下载

[root@192 ~]# yum -y install httpd mariadb-server mariadb php php-mysql
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
CentOS-8 - AppStream                           0.0  B/s |   0  B     00:08    
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

 1.  先排除网络问题检查网通不通,然后确定DNS解析是否正确。

[root@192 ~]# ping www.baidu.com
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=12.3 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=12.2 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=12.7 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=13.5 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=128 time=12.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=128 time=12.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=7 ttl=128 time=13.7 ms

2.更换国内的yum源

  • 阿里yum源: centos镜像-centos下载地址-centos安装教程-阿里巴巴开源镜像站
  • 腾云yum源: CentOS
  • [root@192 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup.3
    [root@192 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo

    3.清理之前的yum缓存。

  • [root@192 ~]# yum clean all
    Repository AppStream is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Repository PowerTools is listed more than once in the configuration
    Repository centosplus is listed more than once in the configuration
    Repository fasttrack is listed more than once in the configuration
    18 files removed

    4.建立新的缓存。

  • [root@192 ~]# yum makecache
    Repository AppStream is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Repository PowerTools is listed more than once in the configuration
    Repository centosplus is listed more than once in the configuration
    Repository fasttrack is listed more than once in the configuration
    CentOS-8 - AppStream                           0.0  B/s |   0  B     00:04    
    Failed to download metadata for repo 'AppStream'
    Error: Failed to download metadata for repo 'AppStream'

要在CentOS 8上使用yum安装JDK 8,可以按照以下步骤进行操作: 1. 首先,使用以下命令查看CentOS 8中可用的JDK版本: ``` yum search java ``` 这将列出所有可用的JDK版本,包括1.8和1.7等。 2. 根据以上引用和引用,我们可以使用以下命令安装OpenJDK 8: ``` sudo yum install -y java-1.8.0-openjdk-devel ``` 这将安装OpenJDK 8的开发包。 3. 如果你更喜欢安装Oracle Java SE(Java 8),可以按照以下步骤进行操作: - 首先,添加Java RPM存储库: ``` sudo yum install -y java-1.8.0-openjdk-headless ``` - 接下来,安装Oracle Java SE的依赖项: ``` sudo yum install -y java-1.8.0-openjdk-devel ``` 这将安装JRE和JVM的依赖项。 请注意,以上步骤中的命令可能需要使用root权限或以sudo方式运行。安装完成后,你将在CentOS 8上成功安装JDK 8。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [centos7 yum安装jdk](https://download.csdn.net/download/weixin_38514322/14856646)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [如何在CentOS8上安装和配置Java 8](https://blog.csdn.net/wcuuchina/article/details/129968274)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值