ubuntu 14.04 apt-get update失败的解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010287342/article/details/80562162

ubuntu 14.04 apt-get update失败解决方法

在ubuntu14.04版本(虚拟机)安装jdk之前,一般我们会执行以下命令从源下载更新到系统

sudo apt-get install update

但这时总会出现形似:”fetch http://……失败。。。“ 的错误

尝试过在ubuntu自带的”system setting“中修改为国内的源,但总是不成功。
偶尔在网上看到一些解决办法,并尝试过确实能够更新成功,后续通过apt-get安装/更新也不再报错,方法很简答:
先切换目录

cd /etc/apt/

然后备份ubuntu中记录源地址的文件:

sudo cp sources.list sources.list.bak

打开sources.list

sudo vim sources.list 

将sources.list中的代码使用#注释 ,并将以下代码拷贝到sources.list ,wq!保存退出

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 

至此结束

猜你喜欢

转载自blog.csdn.net/u010287342/article/details/80562162