树梅派更新镜像源(解决下再更新包慢)----stretch 版本类型

树梅派的默认镜像貌似出了问题太慢,于是就得换一个快一点的镜像

更换软件更新源 (/etc/apt/sources.list),更换系统更新源 (/etc/apt/sources.d/raspi.list)。对这两个文件进行修改,将其中的源网址更换为国内镜像站点。

硬件:Raspberry Pi 3 Model B+ - Raspberry Pi 2017
系统:2018-11-13-raspbian-stretch.zip - stretch 版本类型
lsb_release -a 查看系统版本类型

pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:    Raspbian
Description:    Raspbian GNU/Linux 9.4 (stretch)
Release:    9.4
Codename:    stretch
pi@raspberrypi:~ $


更换源之前

pi@raspberrypi:~ $ sudo apt-get update
获取:1 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]                         
获取:3 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [41.3 kB]
命中:4 http://raspbian.raspberrypi.org/raspbian stretch InRelease                                                                                 
获取:2 http://120.52.51.18/archive.raspberrypi.org/debian stretch/main armhf Packages [201 kB]
已下载 226 kB,耗时 54(4,182 B/s)
正在读取软件包列表... 完成
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ sudo apt-get upgrade
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
正在计算更新... 完成
下列软件包将被升级:
base-files geany geany-common gtk2-engines-clearlookspix libarchive13 libbasicusageenvironment1 libgroupsock8 libgs9 libgs9-common
  liblivemedia57 libobrender32v5 libobt2v5 libpam-systemd libperl5.24 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0
  libsdl1.2debian libsmbclient libssl1.0.2 libssl1.1 libsystemd0 libtiff5 libudev1 libusageenvironment3 libvlc-bin libvlc5 libvlccore9
  libwbclient0 obconf openbox openssl perl perl-base perl-modules-5.24 pi-greeter pipanel policykit-1 python-rpi.gpio python3-rpi.gpio
  raspberrypi-sys-mods raspberrypi-ui-mods raspi-config rp-prefapps rpi-chromium-mods samba-common samba-libs systemd systemd-sysv udev vlc
  vlc-bin vlc-data vlc-l10n vlc-plugin-base vlc-plugin-notify vlc-plugin-qt vlc-plugin-samba vlc-plugin-skins2 vlc-plugin-video-output
  vlc-plugin-video-splitter vlc-plugin-visualization zenity zenity-common
升级了 64 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 57.1 MB 的归档。
解压缩后将会空出 317 kB 的空间。
您希望继续执行吗? [Y/n] Y
获取:26 http://archive.raspberrypi.org/debian stretch/main armhf libvlccore9 armhf 3.0.6-0+rpt1+deb9u1 [478 kB]                                                         
获取:29 http://archive.raspberrypi.org/debian stretch/main armhf libvlc5 armhf 3.0.6-0+rpt1+deb9u1 [162 kB]                                                             
获取:30 http://archive.raspberrypi.org/debian stretch/ui armhf rpi-chromium-mods armhf 20190103 [9,176 kB]                                                        
获取:1 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf base-files armhf 9.9+rpi1+deb9u6 [67.5 kB]                                                        
获取:2 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libperl5.24 armhf 5.24.1-3+deb9u5 [2,837 kB]                                                      
获取:3 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf perl armhf 5.24.1-3+deb9u5 [219 kB]                                                               
获取:4 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf perl-base armhf 5.24.1-3+deb9u5 [1,198 kB]                                                        
获取:34 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-skins2 armhf 3.0.6-0+rpt1+deb9u1 [491 kB]                                                   
获取:5 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf perl-modules-5.24 all 5.24.1-3+deb9u5 [2,722 kB]                                                  
获取:35 http://archive.raspberrypi.org/debian stretch/main armhf vlc armhf 3.0.6-0+rpt1+deb9u1 [138 kB]                                                                 
获取:36 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-qt armhf 3.0.6-0+rpt1+deb9u1 [1,001 kB]                                                     
获取:37 http://archive.raspberrypi.org/debian stretch/main armhf vlc-bin armhf 3.0.6-0+rpt1+deb9u1 [156 kB]                                                             
获取:38 http://archive.raspberrypi.org/debian stretch/main armhf libvlc-bin armhf 3.0.6-0+rpt1+deb9u1 [122 kB]                                                          
获取:39 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-video-output armhf 3.0.6-0+rpt1+deb9u1 [234 kB]                                             
获取:40 http://archive.raspberrypi.org/debian stretch/main armhf libsdl1.2debian armhf 1.2.15+dfsg1-4+rpt1 [160 kB]                                                     
获取:12 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libwbclient0 armhf 2:4.5.12+dfsg-2+deb9u4 [121 kB]                                               
获取:13 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libsmbclient armhf 2:4.5.12+dfsg-2+deb9u4 [144 kB]                                               
获取:41 http://archive.raspberrypi.org/debian stretch/main armhf vlc-l10n all 3.0.6-0+rpt1+deb9u1 [5,732 kB]                                                            
获取:14 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf samba-libs armhf 2:4.5.12+dfsg-2+deb9u4 [4,379 kB]                                               
获取:15 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf samba-common all 2:4.5.12+dfsg-2+deb9u4 [172 kB]                                                 
获取:16 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libarchive13 armhf 3.2.2-2+deb9u1 [253 kB]                                                       
获取:17 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libbasicusageenvironment1 armhf 2016.11.28-1+deb9u1 [19.7 kB]                                    
获取:18 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libgroupsock8 armhf 2016.11.28-1+deb9u1 [24.8 kB]                                                
获取:19 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf liblivemedia57 armhf 2016.11.28-1+deb9u1 [265 kB]                                                
获取:20 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libusageenvironment3 armhf 2016.11.28-1+deb9u1 [12.2 kB]                                         
获取:23 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libtiff5 armhf 4.0.8-2+deb9u4 [220 kB]                                                           
获取:24 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libgs9 armhf 9.26~dfsg-0+deb9u2 [1,863 kB]                                                       
获取:25 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libgs9-common all 9.26~dfsg-0+deb9u2 [5,142 kB]                                                  
获取:27 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf policykit-1 armhf 0.105-18+deb9u1 [61.7 kB]                                                      
获取:28 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libpolkit-agent-1-0 armhf 0.105-18+deb9u1 [22.3 kB]                                              
获取:31 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libpolkit-backend-1-0 armhf 0.105-18+deb9u1 [39.8 kB]                                            
获取:32 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf libpolkit-gobject-1-0 armhf 0.105-18+deb9u1 [37.8 kB]                                            
获取:6 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf systemd-sysv armhf 232-25+deb9u7 [81.6 kB]                                              
错误:21 http://mirrors.opencas.cn/raspbian/raspbian stretch/main armhf libssl1.0.2 armhf 1.0.2q-1~deb9u1                                                                
  无法发起与 mirrors.opencas.cn:80 (2001:cc0:2020:4075::211) 的连接 - connect (101: 网络不可达)
错误:22 http://mirrors.opencas.cn/raspbian/raspbian stretch/main armhf libssl1.1 armhf 1.1.0j-1~deb9u1                                                                  
  无法发起与 mirrors.opencas.cn:80 (2001:cc0:2020:4075::211) 的连接 - connect (101: 网络不可达)
错误:33 http://mirrors.opencas.cn/raspbian/raspbian stretch/main armhf openssl armhf 1.1.0j-1~deb9u1                                                                    
  无法发起与 mirrors.opencas.cn:80 (2001:cc0:2020:4075::211) 的连接 - connect (101: 网络不可达)
获取:7 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf libpam-systemd armhf 232-25+deb9u7 [174 kB]                                             
获取:8 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf libsystemd0 armhf 232-25+deb9u7 [259 kB]                                                
获取:9 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf systemd armhf 232-25+deb9u7 [2,221 kB]                                                  
获取:10 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf udev armhf 232-25+deb9u7 [1,072 kB]                                                    
获取:11 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf libudev1 armhf 232-25+deb9u7 [120 kB]                                                  
获取:42 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-base armhf 3.0.6-0+rpt1+deb9u1 [2,474 kB]                                                   
获取:43 http://archive.raspberrypi.org/debian stretch/main armhf vlc-data all 3.0.6-0+rpt1+deb9u1 [445 kB]                                                              
获取:44 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-notify armhf 3.0.6-0+rpt1+deb9u1 [123 kB]                                                   
获取:45 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-samba armhf 3.0.6-0+rpt1+deb9u1 [123 kB]                                                    
获取:46 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-video-splitter armhf 3.0.6-0+rpt1+deb9u1 [136 kB]                                           
获取:47 http://archive.raspberrypi.org/debian stretch/main armhf vlc-plugin-visualization armhf 3.0.6-0+rpt1+deb9u1 [138 kB]                                            
获取:48 http://archive.raspberrypi.org/debian stretch/ui armhf geany armhf 1.29-1+rpt2 [1,224 kB]                                                                       
获取:49 http://archive.raspberrypi.org/debian stretch/ui armhf geany-common all 1.29-1+rpt2 [2,461 kB]                                                                  
获取:50 http://archive.raspberrypi.org/debian stretch/ui armhf gtk2-engines-clearlookspix armhf 1:2.20.7 [66.0 kB]                                                      
获取:51 http://archive.raspberrypi.org/debian stretch/ui armhf libobt2v5 armhf 3.6.1-4+rpi9 [62.3 kB]                                                                   
获取:52 http://archive.raspberrypi.org/debian stretch/ui armhf libobrender32v5 armhf 3.6.1-4+rpi9 [69.6 kB]                                                             
获取:53 http://archive.raspberrypi.org/debian stretch/ui armhf obconf armhf 1:2.0.4+git20150213-2+rpt1 [123 kB]                                                         
获取:54 http://archive.raspberrypi.org/debian stretch/ui armhf openbox armhf 3.6.1-4+rpi9 [281 kB]                                                                      
获取:55 http://archive.raspberrypi.org/debian stretch/ui armhf pi-greeter armhf 0.9 [40.8 kB]                                                                           
获取:56 http://archive.raspberrypi.org/debian stretch/ui armhf zenity-common all 3.28.1-1.1~bpo9+rpt1 [4,126 kB]                                                        
获取:57 http://archive.raspberrypi.org/debian stretch/ui armhf zenity armhf 3.28.1-1.1~bpo9+rpt1 [268 kB]                                                               
获取:58 http://archive.raspberrypi.org/debian stretch/ui armhf pipanel armhf 20181126~094616 [19.2 kB]                                                                  
获取:59 http://archive.raspberrypi.org/debian stretch/main armhf python-rpi.gpio armhf 0.6.5~stretch-1 [23.5 kB]                                                        
获取:60 http://archive.raspberrypi.org/debian stretch/main armhf python3-rpi.gpio armhf 0.6.5~stretch-1 [23.6 kB]                                                       
获取:61 http://archive.raspberrypi.org/debian stretch/main armhf raspberrypi-sys-mods armhf 20181127 [10.2 kB]                                                          
获取:62 http://archive.raspberrypi.org/debian stretch/ui armhf rp-prefapps armhf 0.5 [175 kB]                                                                           
获取:63 http://archive.raspberrypi.org/debian stretch/ui armhf raspberrypi-ui-mods all 1.20181206 [318 kB]                                                              
获取:64 http://archive.raspberrypi.org/debian stretch/ui armhf raspi-config all 20181118 [20.2 kB]                                                                      
已下载 54.3 MB,耗时 310(285 kB/s)                                                                                                                                
E: 无法下载 http://mirrors.opencas.cn/raspbian/raspbian/pool/main/o/openssl1.0/libssl1.0.2_1.0.2q-1~deb9u1_armhf.deb  无法发起与 mirrors.opencas.cn:80 (2001:cc0:2020:4075::211) 的连接 - connect (101: 网络不可达)
E: 无法下载 http://mirrors.opencas.cn/raspbian/raspbian/pool/main/o/openssl/libssl1.1_1.1.0j-1~deb9u1_armhf.deb  无法发起与 mirrors.opencas.cn:80 (2001:cc0:2020:4075::211) 的连接 - connect (101: 网络不可达)
E: 无法下载 http://mirrors.opencas.cn/raspbian/raspbian/pool/main/o/openssl/openssl_1.1.0j-1~deb9u1_armhf.deb  无法发起与 mirrors.opencas.cn:80 (2001:cc0:2020:4075::211) 的连接 - connect (101: 网络不可达)
E: 有几个软件包无法下载,要不运行 apt-get update 或者加上 --fix-missing 的选项再试试?



2.更换源


2.1 备份源文件

现备份 万一崩了拉

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

sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak


2.2更换软件更新源 (/etc/apt/sources.list)

pi@raspberrypi:~ $ sudo leafpad /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

如图绿色替换红色 注释掉红色部分


2.3 更换系统更新源 (/etc/apt/sources.d/raspi.list)

pi@raspberrypi:~ $ sudo leafpad /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
如图绿色替换红色 注释掉红色部分



3. 更换源之后

sudo apt-get update

sudo apt-get upgrade

如果出现如下情况 就按红色输入

sudo apt –fix-braken install




  目录