弹性云服务器 ECS-执行yum makecache后,下载速度变慢怎么办?:操作步骤

时间:2023-11-01 16:25:21

操作步骤

  1. 执行以下命令,备份配置文件。

    cp -a /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

    mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

  2. 修改epel.repo文件。

    执行以下命令,取消baseurl开头的行的注释;增加mirrorlist开头的行的注释;将文件中的http://download.fedoraproject.org/pub替换成https://repo.huaweicloud.com。

    sed -i "s/#baseurl/baseurl/g" /etc/yum.repos.d/epel.repo

    sed -i "s/metalink/#metalink/g" /etc/yum.repos.d/epel.repo

    sed -i "s@http://download.fedoraproject.org/pub@https://repo.huaweicloud.com@g" /etc/yum.repos.d/epel.repo

  3. 执行yum update更新软件列表。
    • 执行命令yum makecache后,如果回显信息为“Another app is currently holding the yum lock”,则需执行命令rm -rf /var/run/yum.pid删除yum.pid文件,然后再执行命令yum makecache生成缓存。
    • 执行命令yum makecache后,如果回显报错“Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again”,则需执行以下命令,更新证书临时禁用epel源即可。

      yum --disablerepo=epel -y update ca-certificates

    • 如果使用过程中发现某些包不可用,可能是数据正在同步,请过几个小时后再重试。
support.huaweicloud.com/ecs_faq/ecs_faq_1010.html