樹莓派NAS(一)——系統(tǒng)安裝

安裝官方系統(tǒng) Raspbian Buster Lite(無(wú)桌面版)

樹莓派

目前安裝系統(tǒng)有兩個(gè)途徑,可以利用官方新出的 Raspberry Pi Imager 工具燒寫系統(tǒng),也可以下載系統(tǒng)鏡像后利用 Etcher 或者 win32diskimager 進(jìn)行燒寫。項(xiàng)目選擇安裝官方的 Raspbian Buster Lite。

Raspberry Pi Imager 下載
Raspbian 系統(tǒng)鏡像下載

我這里選擇 Raspberry Pi OS Lite 無(wú)桌面版本

圖片

請(qǐng)根據(jù)系統(tǒng)版本下載對(duì)應(yīng)的工具,我是 Windows 10,因此對(duì)應(yīng)的為 for Windows (x86|x64)。

格式化 SD 卡

打開下載好的 SD 卡格式化工具

圖片

系統(tǒng)燒寫

使用 Etcher 燒寫

  1. 從上述鏈接中下載 Raspberry Pi OS Lite 系統(tǒng)鏡像(下載為 zip 壓縮文件,請(qǐng)解壓為 img 文件)以及 Etcher 燒寫工具。

  2. 將 SD 卡通過(guò)讀卡器連接至你的電腦中,選擇系統(tǒng)鏡像、SD 卡盤符;點(diǎn)擊 Flash! 進(jìn)行燒寫。

    圖片

    使用 Raspberry Pi Imager 進(jìn)行燒寫我這里就不進(jìn)行演示了,大致步驟與上述是一致的

配置

SSH 配置

默認(rèn)系統(tǒng) * 不開啟 ssh 服務(wù),根目錄并新建空文件 ssh,不加后綴,即可啟動(dòng)時(shí)開始 ssh,方便遠(yuǎn)程連接

方法:將 SD 卡使用讀卡器連接到 pc 上,打開 SD 卡盤符在 boot 分區(qū)下新建 “ssh” 文本文檔,并刪除后綴.txt

圖片

WIFI 配置

  1. 在 boot 分區(qū)下新建 wpa_supplicant.conf 文檔
  2. 打開 wpa_supplicant.conf 輸入以下配置:可以用 network {} 同時(shí)配置多個(gè)無(wú)線網(wǎng)絡(luò)
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
 ssid="WiFi名,不刪除引號(hào),不能有中文" 
 psk="密碼,不刪除引號(hào)" 
 priority=數(shù)字,數(shù)字越大代表優(yōu)先級(jí)越高
}

network={
 ssid="第二個(gè)WiFi名"
 psk="第二個(gè)密碼" 
 priority=數(shù)字,數(shù)字越大代表優(yōu)先級(jí)越高 
}

啟動(dòng)連接樹莓派

  1. 硬件連接并開機(jī):將 SD 卡插入樹莓派,打開電源開關(guān),樹莓派上的綠色指示燈會(huì)閃爍,說(shuō)明系統(tǒng)正常。
  2. 獲取樹莓派的動(dòng)態(tài) IP 地址:直接在路由器后臺(tái)中找到樹莓派 ip 地址,或者使用 Advanced IP Scanner 獲取。
  3. 利用 ssh 工具遠(yuǎn)程登錄樹莓派:可以使用任意你熟悉的 ssh 連接工具,我這里使用 FinalShell
  • 默認(rèn)用戶名密碼:pi/raspberry
圖片

連接成功:

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.

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.

pi@raspberrypi:~ $

更換軟件源

軟件源的選擇

默認(rèn)情況下,樹莓派軟件源地址是 http://archive.raspbian.org/,位于歐洲,在國(guó)內(nèi)訪問(wèn)是非常慢的,經(jīng)常只有幾 k 每秒的下載速率。所以我們?cè)谕孓D(zhuǎn)樹莓派之前,強(qiáng)烈推薦替換成國(guó)內(nèi)的軟件源。

樹莓派的所有軟件源地址可以從這里找到:https://www.raspbian.org/RaspbianMirrors

一般我們找個(gè)國(guó)內(nèi)的就行了,比如清華大學(xué)

圖片

更換

  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
  1. 修改
   sudo nano /etc/apt/sources.list

如下列所示,將原內(nèi)容注釋,添加清華軟件源

   deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
   deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
   #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

按 ctrl-o 保存,按 ctrl-x 關(guān)閉

/etc/apt/sources.list.d/raspi.list 如法炮制

   deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main
   deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main   
   #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

更新系統(tǒng),就會(huì)發(fā)現(xiàn)速度快了很多了

   sudo apt-get update -y && sudo apt-get upgrade -y

啟用 root

  1. 設(shè)置 root 密碼

      sudo passwd root
    
  2. 解鎖 root 用戶

      sudo passwd --unlock root
    
  3. 切換用戶

      su root
    
  4. 修改 ssh 配置允許 root 登錄

       sudo nano /etc/ssh/sshd_config
    
  5. 找到 PermitRootLogin, 取消注釋并修改

    PermitRootLogin yes
    

至此,樹莓派完成了燒寫系統(tǒng) + 無(wú)屏幕的無(wú)線 wifi 遠(yuǎn)程連接。

原文鏈接:樹莓派NAS(一)——系統(tǒng)安裝 楓殤NET開發(fā)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容