安装ubuntu后为了使下载及更新软件包更快,需要将自带的源更换为国内的源。以下以163为例:
1.首先备份下原始自带源;
sudo cp sources.list /etc/apt/sources.list.backup
2.到http://mirrors.163.com的ubuntu使用帮助文档中,下载相应版本的sources.list, 覆盖/etc/apt/sources.list即可;
使用vim编辑器打开sources.list文件,复制粘贴替换掉刚下载好的sources.list.precise(由于本人使用的是precise-ubuntu 12.04版本的),编辑完后保存退出。
deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
3.更新源
sudo apt-get update
P.S. 除了163国内还有其他源可供选择:
★ 搜狐:http://mirrors.sohu.com/help/ubuntu.html
★ 北京理工大学
★ 中国科技大学
......