ubuntu 14.04 apt-get update失敗的解決辦法
阿新 • • 發佈:2019-02-14
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
至此結束