Ubuntu安装后默认的官方源是美国的服务器,但是美国服务器在国内安装软件等会有较大的限制。所以我们需要将默认的源切换为国内源。一般来说,常用的国内源有阿里源(这是中国官方源)、网易源和搜狐源等等。除此之外,还有高校源,比如清华、中科大以及浙大等等。如果是在校学生,那么换成自己学校内部的源,更新和安装软件的速度会很快。如果是非校园网络,那么最推荐的就是阿里源。不同版本的Ubuntu系统的源列表不相同,在这里我只列举Ubuntu 14.04和Ubuntu 16.04两种系统的源列表。

1. 更换源的两种方式

(1)打开系统设置选择,software&updates,如下:

ubuntu换源方法(Ubuntu下几种常用到的国内源)(1)

然后在跳出来的框中点击选择”Download from:“选项

再点击other选项会出现一个choose a download server框并选择China,里面有很多国内服务器可选择。

(2)在sources.list文件中手动更改源,即将对应源列表中的代码复制到sources.list文件中,过程如下:

<1> 打开终端,通过cd指令进入sources.list文件所在目录。

$ cd /etc/apt

<2> 将原sources.list文件拷贝做备份,可以进入/etc/apt目录下看到有一个sources.list.bak文件。$ sudo cp sources.list sources.list.bak

<3> 通过gedit指令对sources.list进行编辑(也可以用vim指令),并将sources.list文件中的内容全选删除,再把对应的源列表的内容复制到文件中。

$ sudo gedit sources.list

<4>访问源列表里的网址,并读取软件列表,然后更新保存在本地电脑,换源结束。

$ sudo apt-get update

2. Ubuntu 14.04常用的源列表

(1)阿里云源

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

(2)网易源

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

(3)教育网之浙大源

deb http://mirrors.zju.edu.cn/ubuntu/ trusty main multiverse restricted universe

deb http://mirrors.zju.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe

deb http://mirrors.zju.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe

deb http://mirrors.zju.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

deb http://mirrors.zju.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe

deb-src http://mirrors.zju.edu.cn/ubuntu/ trusty main multiverse restricted universe

deb-src http://mirrors.zju.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe

deb-src http://mirrors.zju.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe

deb-src http://mirrors.zju.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

deb-src http://mirrors.zju.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe

(4)教育网之中科大源

deb http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe

(5)教育网之清华源

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse

3. Ubuntu 16.04常用的源列表

(1)阿里云源

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

(2)网易源

deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

(3)教育网之浙大源

deb http://mirrors.zju.edu.cn/ubuntu xenial main universe restricted multiverse

deb http://mirrors.zju.edu.cn/ubuntu xenial-security main universe restricted multiverse

deb http://mirrors.zju.edu.cn/ubuntu xenial-updates main universe restricted multiverse

deb http://mirrors.zju.edu.cn/ubuntu xenial-proposed main universe restricted multiverse

deb http://mirrors.zju.edu.cn/ubuntu xenial-backports main universe restricted multiverse

deb-src http://mirrors.zju.edu.cn/ubuntu xenial main universe restricted multiverse

deb-src http://mirrors.zju.edu.cn/ubuntu xenial-security main universe restricted multiverse

deb-src http://mirrors.zju.edu.cn/ubuntu xenial-updates main universe restricted multiverse

deb-src http://mirrors.zju.edu.cn/ubuntu xenial-proposed main universe restricted multiverse

deb-src http://mirrors.zju.edu.cn/ubuntu xenial-backports main universe restricted multiverse

(4)教育网之中科大源

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse

deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

(5)教育网之清华源

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe

deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe

,