Ubuntu 18.04 软件源修改成国内源

本文介绍修改Ubuntu的apt-get源为国内镜像源的方法。

命令行方式

1、 备份原文件

1
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、编辑源列表文件

1
$ sudo vim /etc/apt/sources.list

3、将原来的列表删除,添加镜像源(请看下文自行选择)

阿里源

https://opsx.alibaba.com/mirror

https://developer.aliyun.com/mirror/ubuntu

名称 标签 更新时间 同步状态 操作
ubuntu 系统 yyyy-MM-dd HH:mm:ss 成功 帮助

点击 帮助 复制弹出来窗口的内容到 sources.list 中。

Ubuntu 14

1
2
3
4
5
6
7
8
9
10
11
12
13
14
deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

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

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

## Not recommended
# deb https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

Ubuntu 16

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

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

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

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

Ubuntu 18.04

1
2
3
4
5
6
7
8
9
10
11
12
13
14
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

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

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

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

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

中科大

http://mirrors.ustc.edu.cn/
http://mirrors.ustc.edu.cn/help/ubuntu.html

163源

http://mirrors.163.com/
http://mirrors.163.com/.help/ubuntu.html

4、 更新软件包列表

1
$ sudo apt-get update

图形界面方式

Ubuntu 18.04 在系统设置里面是找不到软件源设置界面按钮的(找了好久都没找到T-T),
所以需要一些指令帮助启动图形界面以便设置软件源。

1、输入命令

1
$ sudo update-manager -c -d

2、会弹出 Software Updater 提示框,等待一会儿后,
点击左下角 Settings… 按钮,久违的软件源设置就会出来啦。

3、选择

  1. 选择 Ubuntu Software
  2. 选择 Download from:
  3. 选择 Other…
  4. 选择 Select Best Server
觉得文章对您有帮助,请我喝瓶肥宅快乐水可好 (๑•̀ㅂ•́)و✧
  • 本文作者: 阿彬~
  • 本文链接: https://iweixubin.github.io/posts/ubuntu/etc-apt-sources-list/
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
  • 免责声明:本媒体部分图片,版权归原作者所有。因条件限制,无法找到来源和作者未进行标注。
         如果侵犯到您的权益,请与我联系删除