• yum -y update 报错: YumRepo Error: All mirror URLs are not using ftp, http[s] or file.


     

    yum更新报错:YumRepo Error: All mirror URLs are not using ftp, http[s] or file.

    1、检查网络是否接通 ping www.baidu.com,如果没有ping成功请先检查网络问题

    2、检查 /etc/yum.repos.d/CentOS-Base.repo文件问题

    如果发现文件中 http://mirror.centos.org/centos/releasever/updates/releasever/updates/releasever/updates/basearch/无法访问

    3、解决404问题,把源站点配置改为国内清华大学站点 https://mirrors.tuna.tsinghua.edu.cn/centos-vault 访问

    修改yum源站点配置:vim /etc/yum.repos.d/CentOS-Base.repo


    对照清华大学镜像站中的目录修改后如下:

    [base]
    name=CentOS-$releasever - Base
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/
    gpgcheck=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
    
    #released updates
    [updates]
    name=CentOS-$releasever - Updates
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/updates/x86_64/
    gpgcheck=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
    
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/extras/x86_64/
    gpgcheck=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/centosplus/x86_64/
    gpgcheck=1
    enabled=0
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
    
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/contrib/x86_64/
    gpgcheck=1
    enabled=0
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
    

     4、验证 执行

    yum -y update

    yum -y install wget

    了解以下操作:

    通过 执行 man yum 查看yum的帮助信息 可以知道
    yum makecache 是 将服务器上的软件包信息 现在本地缓存,以提高 搜索 安装软件的速度
    yum 主要的一下命令如下:
    yum search 软件包 搜索软件包
    yum install 软件包 安装软件包
    yum remove 软件包
    yum update 更新系统

  • 相关阅读:
    待重写
    待重写
    待重写
    ReflectionUtils使用
    kafka消费组、消费者
    待重写
    Map接口常用实现类学习
    利用httpClient发起https请求
    sql常用格式化函数及字符串函数
    method reference
  • 原文地址:https://www.cnblogs.com/M87-A/p/14838522.html
Copyright © 2020-2023  润新知