默认更新源速度较慢,可以通过修改系统默认下载源为国内镜像源加速下载过程。
Step1 备份当前下载源文件
cd /etc/apt
sudo cp sources.list sources.list.bak
Step2 修改sources.list
sudo vim sources.list
清空该文件,选择国内镜像源粘贴进去,以阿里源为例:
# deb包
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-backports main restricted universe multiverse
# 测试版源
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
## 以下为源码,建议注释掉,不然后期使用 apt-update 更新时可能会引发多次编译的错误
# 源码
# 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-backports main restricted universe multiverse
# 测试版源
# deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ xenial partner
deb http://extras.ubuntu.com/ubuntu/ xenial main
Step3 保存,退出,更新
sudo apt-get update
sudo apt-get upgrade
Raspberry Pi
使用管理员权限(经由sudo),编辑 /etc/apt/sources.list
文件。参考命令行为:
$ sudo vim /etc/apt/sources.list
用 #
注释掉原文件内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
使用管理员权限(经由sudo),编辑 /etc/apt/sources.list.d/raspi.list
文件。参考命令行为:
$ sudo vim /etc/apt/sources.list.d/raspi.list
用 #
注释掉原文件内容,用以下内容取代:
deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
网友评论