欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu18.04..5 配置国内镜像源:解决E: Failed to fetch

程序员文章站 2022-03-13 12:28:47
...

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

问题描述

使用 sudo apt get-install 出现E: Failed to fetch问题。

Ubuntu18.04..5 配置国内镜像源:解决E: Failed to fetch

更换镜像源

错误原因:绝大多数情况下,ROS更新的下载源都是正常的,所以出现这个问题,应该是自己系统一些配置设置问题。

既然网络出现问题,我们更换下载源:

使用geditvi/vim打开配置文件:

  • sudo gedit /etc/apt/sources.list

或者

  • sudo vim /etc/apt/sources.list

替换里面全部内容

  1. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  2. deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  4. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  6. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  7. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  9. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Ubuntu18.04..5 配置国内镜像源:解决E: Failed to fetch

or

Ubuntu18.04..5 配置国内镜像源:解决E: Failed to fetch

然后生效配置文件(刷新列表)

  1. sudo apt-get update

注意:一定要执行刷新

配置DNS网关

Terminal下输入命令

  1. sudo gedit /etc/resolv.conf

或者

  1. sudo vi /etc/resolv.conf

在resolv.conf里面添加阿里DNS

  1. nameserver 127.0.0.53
  1. sudo apt-get update

本文转自:https://blog.csdn.net/qq_46092061/article/details/118878697