ubuntu 执行apt-get update报错Failed to fetch
在ubuntu下执行sudo apt-get update时,经常会遇到报错:
Err http://security.ubuntu.com precise-security InRelease Err http://security.ubuntu.com precise-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Err http://cn.archive.ubuntu.com precise InRelease Err http://cn.archive.ubuntu.com precise-updates InRelease Err http://cn.archive.ubuntu.com precise-backports InRelease Err http://cn.archive.ubuntu.com precise Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-updates Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-backports Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Temporary failure resolving 'security.ubuntu.com' W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
这是因为镜像源除出了问题,一般都会推荐使用国内的镜像源,比如163或者阿里云或者清华大学的镜像服务器 (强烈建议使用清华镜像)
清华镜像源官网:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
将下列文本添加到/etc/apt/sources.list文件里
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse # 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
或者进入repogen.simplylinux.ch 选择合适的Ubuntu版本后,在ubuntu Branches下全选
拉至网页最下,点击生产,复制list下内容,添加到/etc/apt/sources.list中即可
具体参考https://jingyan.baidu.com/article/afd8f4de66efcf34e286e993.html?st=2&os=0&bd_page_type=1&net_type=2
修改镜像源之后需要重新更新:
sudo apt-get update;sudo apt-get upgrade
如果执行sudo apt-get update仍然报错,问题在于DNS没有配置好。
解决方法:
sudo vi /etc/resolv.conf
在其中添加:
# Dynamic resolv.conf() file for glibc resolver() generated by resolvconf()
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
#这里用的是阿里云的DNS服务器
nameserver 223.5.5.5
nameserver 223.6.6.6
ubuntu 执行apt-get update报错Failed to fetch的更多相关文章
- Ubuntu执行sudo apt-get update报错E: 无法获得锁 /var/lib/apt/lists/lock - open (11: 资源暂时不可用) E: 无法对目录 /var/lib/apt/lists/ 加锁
一.强制解锁,执行语句 sudo rm /var/lib/apt/lists/lock 二.终端输入 ps -aux | grep apt-get 查看一下apt-get的相关进程.然后sudo ki ...
- 执行sudo apt-get update报错
1.在官网源https://mirrors.ustc.edu.cn/repogen/下载对应版本最新的源,比如我是16.04版本的ubuntu,对应下载的是这个 2.下载sources.list完成之 ...
- 最新cenos执行service httpd restart 报错Failed to restart httpd.service: Unit not found.
原来是需要将Apache注册到Linux服务里面啊!注册Apache到Linux服务在Linux下用源代码方式编译安装完Apache后,启动关闭Apache可以通过如下命令实现: /usr/local ...
- Linux - Ubuntu下执行apt-get update报错:Some index files failed to download. They have been ignored, or old ones used instead.
报错命令 root@ubuntu:/etc/apt# apt-get update Err: http://mirrors.aliyun.com/ubuntu trusty InRelease Cou ...
- Ubuntu遇到apt-get update报错:"E: Could not get lock /var/lib/apt/lists/lock"
sudo apt-get update报错:"E: Could not get lock /var/lib/apt/lists/lock" 出现此问题的原因可能是有另外一个程序在运 ...
- mysql执行update报错1175解决方法
mysql执行update报错 update library set status=true where 1=1 Error Code: 1175. You are using safe update ...
- mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY
mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY 今天开发的同事发来如下错误信息,最最简 ...
- 【mybatis】mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wait timeout exceeded; try restarting transaction
今天使用mybatis和jpa的过程中,发现这样一个问题: mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wai ...
- k8s 执行 ingress yaml 文件报错: error when creating "ingress-myapp.yaml": Internal error occurred: failed calling webhook
k8s 执行 ingress yaml 文件报错:错误如下: [root@k8s-master01 baremetal]# kubectl apply -f ingress-test.yaml Err ...
随机推荐
- 洛谷P1823 [COI2007] Patrik 音乐会的等待
https://www.luogu.org/problemnew/show/P1823 自己只会一个log的 设取的人的位置分别是l,r(l<r) 这个做法大概是考虑枚举r,设法对于每个r求出有 ...
- Java设计模式之单例模式 - Singleton
用来创建独一无二的,是能有一个实例的对象的入场券.告诉你一个好消息,单例模式的类图可以说是所有模式的类图中最简单的,事实上,它的类图上只有一个类!但是,可不要兴奋过头,尽管从类设计的视角来说很简单,但 ...
- Java 图形界面开发--图文并茂建立学生管理系统
(尊重劳动成果,转载请注明出处:http://blog.csdn.net/qq_25827845/article/details/50932501 冷血之心的博客) 图形用户界面(Graphics U ...
- node.js之Windows 系统下设置Nodejs NPM全局路径
node.js 0.10 版本下修改全局路径: npm config set cache "D:\nodejs\node_cache" npm config set prefix ...
- No input file specified的解决方法
(一)IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二:请修改php.ini找到; cgi.for ...
- 华硕笔记本刷BIOS
笔记本硬件升级后想使用微软的Windows xp mode,之后发现笔记本BIOS中没有虚拟化选项,想通过升级BIOS的方法来解决,结果失败. 升级后出现关机后无法关闭电源指示灯以及风扇的问题,之后只 ...
- win7 ghost 纯净版最新系统下载
这个系统是WIN7系统GHOST版装机旗舰版 SP1,更新了系统补丁到2016-02(可通过微软漏洞扫描和卫士漏洞扫描),升级Internet Explorer为IE9,增加数款驱动的支持,支持最新的 ...
- C++类构造函数、析构函数运行机理
http://blog.sina.com.cn/s/blog_6fd68d5f0100n60h.html 前言--构造函数.析构函数的简单理解:1)构造函数---对象被创建时候调用的函数:2)析构函数 ...
- ueditor1.4.3.all.js报错
.replace( /<[^>/]+>/g, '' ) 转义符问题! 修改为: .replace( /<[^>\/]+>/g, '' )
- Linux网卡设置为网桥模式
Linux网卡设置为网桥模式 1. 添加网卡,并修改相关配置文件 1.1虚拟机添加网卡,并配置相关文件 如:eth2为新添加网卡 cd /etc/sysconfig/network-script ...