0.前言
通過改動ubuntu軟件源可提高apt命令下載安裝軟件的速度。
參考資料
【官方資料】——配置文件改動方法
【Ubuntu如何改動軟件源地址】——使用ubuntu軟件中心改動(推薦)
1.使用ubuntu軟件中心更新
請參考【Ubuntu如何改動軟件源地址】——來自百度經驗

圖1 打開軟件和更新

圖2 選擇國內軟件源
2.使用指令方法改動
【1】首先備份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
【2】gedit打開 並替換全部內容
sudo gedit /etc/apt/sources.list
【2.1】 若ubunt版本號為13.04
【163源】
deb http://mirrors.163.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-backports main restricted universe multiverse
【阿里雲源】
deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
【2.2】 若ubuntu版本號為12.04
將上述列表地址中的 raring 替換為 precise 就可以
【3】刷新列表
sudo apt-get update
【3.1】若運行apt-get update產生錯誤
【錯誤現象】
E: Could not get lock /var/lib/apt/lists/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the list directory
【錯誤原因】可能為之前操作使用ctrl+c強制退出apt-get 指令。而實際apt-get進程依舊存在。
【解決方法】
【a】查看進程(使用grep指令過濾其它進程)
ps -e | grep apt
【b】apt-get進程依舊存在
6362 ? 00:00:00 apt
6934 ? 00:00:00 apt-get
【c】銷毀進程
sudo killall apt
sudo killall apt-get
【d】又一次運行
sudo apt-get update
