本文树莓派为3B+,系统为Raspbian(stretch)
Version:June 2018
Release date:2018-06-27
Kernel version:4.9
推荐使用清华源
https://mirror.tuna.tsinghua.edu.cn/help/raspbian/
查看树莓派的版本
查看树莓派的版本:
lsb_release -a
➜ ~ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch
修改source.list
根据版本修改相应的源
上面的输出说明源为stretch
,查找到相应的源,进行替换。
替换源的文件一般在/etc/apt/
文件夹下。
修改source.list
文件的默认的内容为
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
将上面的源注释掉,添加以下内容
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
并把原来的东西注释掉.
修改raspi.list
文件
还需要修改/etc/apt/sources.list.d
文件夹下的raspi.list
文件的默认的内容为
deb http://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ stretch main ui
将上面的源注释掉,添加以下内容
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui
更新完成后,更新软件源
sudo apt-get update -y
sudo apt-get dist-upgrade -y
也可以不用加-y
reference
[1] https://blog.youkuaiyun.com/qq_38632611/article/details/79710689