1. 程式人生 > >Ubuntu16.04 換源(或者404 Not Found問題)

Ubuntu16.04 換源(或者404 Not Found問題)

style 現在 href soft pack detail package hub 粘貼

當執行sudo apt-get update或者sudo apt-get install命令時,出現以下兩個問題:

“apt-get 404 Not Found Package Repository Errors” 和 “E: Some index files failed to download They have been ignored, or old ones used” 

解決方法:

首先,我們將現在出問題的 /etc/apt/sources.list 文件備份一份(只是一個好習慣而已!)

sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

註: /etc/apt/sources.list 文件 裏面存放的是 Linux系統需要的軟件源的網站。

接著,我們重新編寫一個 /etc/apt/sources.list 文件:

sudo gedit /etc/apt/sources.list


將下面的模板內容,復制粘貼到 /etc/apt/sources.list 文件(此時保證該文件是空的!!!)裏面,然後保存。(我們使用的Ubuntu 16.04)

deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##測試版源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源碼
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##測試版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse

此時可以打開系統設置System Settings來更換源了。

現在再執行:sudo apt-get update,就不會報錯了。


必須註意:如要用於其他版本,把 xenial 換成相應版本代號就好。可自行在網上搜索其他版本的模板!

參考鏈接:https://blog.csdn.net/github_35160620/article/details/52115542

Ubuntu16.04 換源(或者404 Not Found問題)