ubuntu修改源列表sourcelist的方法

时间:2022-06-06 19:25:50

1.备份源列表

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

2.找到对应版本的源,可以在以下界面当中找到,主要版本要对。http://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8。

当前我的是12.04版本,使用163的源,所以源列表如下。

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.编辑sourcelist

执行以下命令编辑sources.list文件,清空里面的内容,拷贝第二步得到的地址到这个文件当中去。

sudo vim /etc/apt/sources.list

4.刷新数据列表

sudo apt-get update

本地源的配置方式:

可以参考以下文章:

ubuntu制作本地源

http://wenku.baidu.com/view/20a88e8ba0116c175f0e487d.html

http://blog.sina.com.cn/s/blog_7cb52fa80101csx5.html