樹莓派3B+ 安裝系統
系統鏡像下載
樹莓派官方鏡像下載地址:自行百度,官方網站首頁,點擊Downloads
安裝鏡像
- 準備一張8G以上的內存卡,推薦16G以上。
- 下載系統製作軟件etcher,將下載到的img鏡像寫入到內存卡中(可以不用解壓系統的zip壓縮包)。
下載地址:https://www.balena.io/etcher/
配置基本環境
配置WiFi連接
- 將刷好系統的內存卡插入到Linux系統的電腦中,在 /etc/wpa_supplicant/wpa_supplicant.conf 文件中寫入WiFi連接信息
network={
ssid="WiFi名稱1"
psk="WiFi密碼1"
}
network={
ssid="WiFi名稱2"
psk="WiFi密碼2"
}
修改鏡像源
經過大量時間的使用,發現國內還是清華大學的鏡像源更加穩定快速。
- 修改 /etc/apt/sources.list
# 將原有的鏡像地址使用 # 號註釋掉
# 複製原有的內容,將鏈接替換成 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
# 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
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
- 修改 /etc/apt/sources.list.d/raspi.list
這個文件是備份的鏡像源,用於更新樹莓派內置的office、IDE等實用桌面軟件。
# 將原有的鏡像地址使用 # 號註釋掉
# 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
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
刷新軟件列表,更新系統組件
將內存卡插入到樹莓派中,開機啓動。
打開終端,輸入:
sudo apt-get update
sudo apt-get upgrade
安裝pip3並設置國內pip源
安裝pip3
sudo apt install python3-pip
更新pip3
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 -U
設置清華pip源
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
總結
網上有很多更換鏡像源的方法,但是大都不全面,可能自己都沒試過。
- 軟件源地址中的 buster 是系統的Codename,和系統是相對應的。
- 在終端中執行 lab_release 命令,可以查看系統的Codename
啓動後記得開啓SSH
sudo raspi-config