xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux change archive mirror All In One

Linux change archive mirror All In One

Linux 发行版: Debian / Ubuntu / Raspberry Pi OS

image

$ sudo apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://archive.raspberrypi.org/debian bullseye InRelease [23.6 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main armhf Packages [232 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main armhf Packages [12.0 kB]
Get:7 http://deb.debian.org/debian bullseye-updates/main arm64 Packages [12.0 kB]
Get:8 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [316 kB]
Get:9 http://archive.raspberrypi.org/debian bullseye/main arm64 Packages [308 kB]
Get:10 http://security.debian.org/debian-security bullseye-security/main arm64 Packages [232 kB]
Get:11 http://security.debian.org/debian-security bullseye-security/main Translation-en [155 kB]
Fetched 1383 kB in 19s (72.9 kB/s)
Reading package lists... Done

应用场景

在中国国内使用境外镜像,下载资源非常慢,经常会出现失败的问题,十分令人恼火;😫 🤬 😤 😡
故,需要切换到国内的大学镜像资源,提高下载速度和提升使用体验 ✅

  1. 清华大学镜像

raspberrypi | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

https://mirrors.tuna.tsinghua.edu.cn/help/raspberrypi/

https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/

  1. 中国科技大学开源软件镜像站

https://mirrors.ustc.edu.cn/

https://mirrors.ustc.edu.cn/raspberrypi/

https://mirrors.ustc.edu.cn/raspberrypi/debian/dists/bullseye/

https://mirrors.ustc.edu.cn/raspberry-pi-os-images/

https://mirrors.ustc.edu.cn/raspberry-pi-os-images/raspios_arm64/images/raspios_arm64-2023-05-03/

image

http://mirrors.ustc.edu.cn/raspbian/raspbian/

https://mirrors.ustc.edu.cn/raspberry-pi-os-images/Raspberry_Pi_Education_Manual.pdf

https://forums.raspberrypi.com/viewtopic.php?t=50754

install

# 安装 vim
$ sudo apt-get install vim

# 安装中文输入法 chinese input ✅
$ sudo apt-get install scim-pinyin

# 安装后,需要设置默认语言 ⚠️
# https://www.cnblogs.com/xgqfrms/p/5355330.html#5166258
# https://blog.nowcoder.net/n/d22f861d07f146c6a6a637f1d2f8bb95
$ sudo raspi-config

# 重启系统
$ sudo reboot
# 或者
$ sudo shutdown -r now

localization options

macOS 关闭本地环境变量 ⚠️

https://www.raspberrypi.com/documentation/computers/configuration.html#raspi-config

https://www.cnblogs.com/xgqfrms/p/5355330.html#5166258

https://blog.nowcoder.net/n/d22f861d07f146c6a6a637f1d2f8bb95

https://askubuntu.com/questions/599808/cannot-set-lc-ctype-to-default-locale-no-such-file-or-directory

test

# disk free
$ df
$ df -h
$ df -Th

image

image

# static ip
$ vim dhcpcd.conf

https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-networking-2

https://www.raspberrypi.com/documentation/computers/configuration.html#static-ip-addresses

solutions

切换 Linux 镜像源 / 切换 Raspberry Pi 镜像源

$ sudo apt-get update

获取:1 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
获取:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
正在读取软件包列表... 完成
E: 仓库'http://archive.raspberrypi.org/debian buster InRelease'将其'Suite'值从'testing'修改到了'oldstable'
N: 为了让这个仓库能够应用,这必须在更新之前显式接受。更多细节请参阅 apt-secure(8) 手册。
E: 仓库'http://raspbian.raspberrypi.org/raspbian buster InRelease'将其'Suite'值从'stable'修改到了'oldstable'
N: 为了让这个仓库能够应用,这必须在更新之前显式接受。更多细节请参阅 apt-secure(8) 手册。
  1. /etc/apt/sources.list
$ sudo vim /etc/apt/sources.list

$  cat /etc/apt/sources.list
# new ✅
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi

# tsinghua 不好使 ❌
# deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
# deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui

# old ❌
# deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# new ✅
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi

# old ❌
# deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
  1. /etc/apt/sources.list.d/raspi.list
$ sudo vim /etc/apt/sources.list.d/raspi.list

$ cat /etc/apt/sources.list.d/raspi.list
# new ✅
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ buster main

# old ❌
#deb http://archive.raspberrypi.org/debian/ buster main

# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ buster main

# new ✅
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ buster main


#deb http://archive.raspberrypi.org/debian/ jessie main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ jessie main ui

USTC Open Source Software Mirror

http://mirrors.ustc.edu.cn/

https://mirrors.ustc.edu.cn/

中国科学技术大学

https://ustc.edu.cn/

获取 IP 通过 SSH 访问 Raspberry Pi

# 获取 IP
$ ping raspberrypi

# SSH, host ✅
$ ssh pi@raspberrypi.local

# SSH, ip ❓需要先删除 hosts 配置
$ ssh pi@192.168.18.135

image

ping

$ ping raspberrypi
ping: cannot resolve raspberrypi: Unknown host

$ ping raspberrypi.local
PING raspberrypi.local (192.168.18.135): 56 data bytes
64 bytes from 192.168.18.135: icmp_seq=0 ttl=64 time=207.268 ms
64 bytes from 192.168.18.135: icmp_seq=1 ttl=64 time=13.262 ms
^C
--- raspberrypi.local ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 13.262/110.265/207.268/97.003 ms

ssh

$ ssh pi@192.168.18.135
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:RDtJTesQX/nQU+4pRcsqtQFV5kXbdM05U5gppFpG2dU.
Please contact your system administrator.
Add correct host key in /Users/xgqfrms-mm/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/xgqfrms-mm/.ssh/known_hosts:4
Host key for 192.168.18.135 has changed and you have requested strict checking.
Host key verification failed.
$ ssh pi@raspberrypi.local
pi@raspberrypi.local's password: 
Permission denied, please try again.
pi@raspberrypi.local's password: 
Permission denied, please try again.
pi@raspberrypi.local's password: 
Linux raspberrypi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Apr 10 01:38:46 2023

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.


fix: Raspberry Pi 无法 SSH 登录,报错 ❌

https://www.cnblogs.com/xgqfrms/p/17329294.html

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

源码镜像切换工具

Linux 软件仓库镜像使用帮助 - MirrorZ Help

https://help.mirrorz.org/

https://github.com/mirrorz-org/mirrorz-help

https://help.mirrorz.org/raspberry-pi-os-images/

https://help.mirrorz.org/raspbian/

国内大学开源软件镜像源

TUNA - 清华大学开源软件镜像站
BFSU - 北京外国语大学开源软件镜像站
HIT - 哈尔滨工业大学开源镜像站
NJU - 南京大学开源镜像站
PKU - 北京大学开源镜像站
CQUPT - 重庆邮电大学开源镜像站
XJTU - 西安交通大学软件镜像站
NJTech - 南京工业大学开源软件镜像站
USTC - 中国科学技术大学开源软件镜像
SJTUG - Zhiyuan - SJTUG 致远镜像站
SUSTech CRA - 南方科技大学开源软件镜像站
ISRC-ISCAS - ISCAS 镜像站
ZJU - 浙江大学开源软件镜像站
SCAU - 华南农业大学开源镜像源
OpenTUNA - OpenTUNA开源软件镜像站

https://help.mirrorz.org/raspberrypi/

/etc/apt/sources.list.d/raspi.list

$ cat /etc/apt/sources.list.d/raspi.list
$ sudo vim /etc/apt/sources.list.d/raspi.list

$ cat <<'EOF' > /etc/apt/sources.list.d/raspi.list
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bullseye main
EOF

https://help.mirrorz.org/debian/

/etc/apt/sources.list

$ cat <<'EOF' > /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

deb https://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free
EOF
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

deb https://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free

refs

https://www.cnblogs.com/xgqfrms/p/17275859.html

https://www.cnblogs.com/xgqfrms/p/17277856.html

如何修复树莓派在更换了一个 SD 系统卡后,无法使用 SSH 登录问题 All In One

https://www.cnblogs.com/xgqfrms/p/17329294.html



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-04-10 12:32  xgqfrms  阅读(68)  评论(14编辑  收藏  举报