首先先備份原始的sources.list
避免我們改爛了沒有可以還原的檔案
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
先使用正規表示法看看有沒有抓到需要更改的字串
cat /etc/apt/sources.list | grep 'http:\/\/.*.ubuntu.com\/ubuntu'
確定無誤以後
再下底下這指令
sudo sed -i 's/tw.archive.ubuntu.com/ubuntu.stu.edu.tw/g' /etc/apt/sources.list
之後就可以下
sudo apt-get update
sudo apt-get upgrade
更新系統囉
另外 Ubuntu 12.04 LTS 又把 Vim 加進來了
要用 Vim 去修改的話
請按照下面步驟
1.
首先先備份原始的sources.list
避免我們改爛了沒有可以還原的檔案
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
2.
之後是把原本的檔案給刪除
所以下底下這指令
sudo rm -rf /etc/apt/sources.list
3.
刪除以後
當然要建立該檔案阿
不然就沒有辦法更新了
所以下底下這指令
sudo vim /etc/apt/sources.list
4.
進到畫面以後
按下鍵盤上面的 Insert 鍵 或者是 i
就進入編輯模式
將底下的東西一字不漏的貼上
#deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precis
e/main/binary-i386/
#deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precis
e/restricted/binary-i386/
#deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ precise main
restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ubuntu.stu.edu.tw/ubuntu/ precise main restricted
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ubuntu.stu.edu.tw/ubuntu/ precise-updates main restricted
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ubuntu.stu.edu.tw/ubuntu/ precise universe
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise universe
deb http://ubuntu.stu.edu.tw/ubuntu/ precise-updates universe
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ubuntu.stu.edu.tw/ubuntu/ precise multiverse
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise multiverse
deb http://ubuntu.stu.edu.tw/ubuntu/ precise-updates multiverse
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ubuntu.stu.edu.tw/ubuntu/ precise-backports main restricted universe multivers
e
deb-src http://ubuntu.stu.edu.tw/ubuntu/ precise-backports main restricted universe multi
verse
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
本文轉自:http://blog.jsdan.com/3648
ubuntu 12.04 更改sources.list
誰在線上
正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客