使用命令
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份源文件
sudo vim /etc/apt/sources.list #修改源文件
sudo apt-get update #更新列表
配置源文件
将 sources.list 文件内容替换如下
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
Ubuntu 版本
不同 ubuntu 版本,源配置不太相同,对照下面表格替换文件中相应位置
Ubuntu version | Repository |
---|---|
Precise 12.04 (LTS) | deb https://apt.dockerproject.org/repo ubuntu-precise main |
Trusty 14.04 (LTS) | deb https://apt.dockerproject.org/repo ubuntu-trusty main |
Wily 15.10 | deb https://apt.dockerproject.org/repo ubuntu-wily main |
Xenial 16.04 (LTS) | deb https://apt.dockerproject.org/repo ubuntu-xenial main |
比如 16.04 版本,执行以下命令
sudo vim /etc/apt/sources.list # 打开源配置文件
:%s/trusty/xenial/g # 执行vim命令>>全局替换trusty为xenial
:wq! # 保存文件并退出
sudo apt update && sudo apt upgrade # 更新软件源并升级可更新软件(非必须执行)
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于