Yuav ua li cas tig Raspberry Pi rau hauv NAS server hauv tsev

Xeem hloov tshiab: 20/03/2025

  • Siv Raspberry Pi raws li NAS yog qhov kev xaiv raug nqi thiab qis zog.
  • Txhim kho Raspberry Pi OS Lite ua kom zoo dua qhov kev ua tau zoo yam tsis tas yuav tsum muaj cov duab kos duab.
  • Samba tso cai rau cov ntaub ntawv sib koom hauv lub network hauv zos nrog kev nkag los ntawm txhua lub cuab yeej.
  • Nrog rau qhov tseeb configuration, NAS tuaj yeem tswj tau nyob deb ntawm SSH.
Tig Raspberry Pi rau hauv NAS server

Koj puas xav kom muaj lub network cia server yam tsis siv nyiaj txiag? La Raspberry Pi yog ib qho kev xaiv zoo tshaj plaws. Ua tsaug rau nws cov versatility thiab muaj peev xwm ntawm kev txuas sab nraud hard drives, koj tuaj yeem ua tau Tig Raspberry Pi rau hauv NAS server hauv tsev. Yooj yim teeb tsa thiab nrog kev siv hluav taws xob tsawg heev. 

Thaum cov khoom lag luam NAS muab cov yam ntxwv siab tshaj tawm ntawm lub thawv, lawv feem ntau tuaj ntawm tus nqi siab. Txawm li cas los xij, nrog Raspberry Pi koj tuaj yeem ua tiav cov txiaj ntsig zoo sib xws nrog kev nqis peev tsawg. Hauv kab lus no peb yuav piav qhia rau koj Cov ntaub ntawv twg koj xav tau thiab cov software twg koj tuaj yeem siv los ua qhov yooj yim thiab siv tau.

Vim li cas thiaj siv Raspberry Pi ua NAS?

NAS servers (Network Txuas Txuas) yog cov cuab yeej tsim los muab network cia uas tuaj yeem nkag tau los ntawm cov khoom siv sib txawv hauv tib lub network hauv zos lossis txawm los ntawm huab. Siv Raspberry Pi ua NAS muaj ntau yam zoo:

  • Nws yog ib qho kev xaiv pheej yig dua: Raspberry Pi nqi ntau dua li NAS kev lag luam.
  • Muab kev siv hluav taws xob tsawg: Los ntawm kev siv ob peb watts, nws tuaj yeem siv tau 24/7 yam tsis tau nce koj cov nqi hluav taws xob.
  • Nws yog customizable heev: Koj tuaj yeem nruab ntau daim ntawv thov thiab kev pabcuam raws li koj xav tau.
  • Tso cai rau kev nkag mus rau tej thaj chaw deb: Configuring nws kom raug tso cai rau koj nkag mus rau cov ntaub ntawv los ntawm txhua qhov chaw.
Cov ntsiab lus tshwj xeeb - Nyem qhov no  Yuav ua li cas paub Ram ntawm kuv lub PC

Txawm li cas los xij, thaum hloov Raspberry Pi rau hauv NAS server, koj yuav tsum nco ntsoov qee qhov kev txwv. Raspberry Pi tsis muaj tib lub zog ua haujlwm raws li tus kws tshaj lij NAS thiab nws cov kev sib txuas hauv network Nws tuaj yeem yog lub raj mis yog tias koj tsis siv tus qauv nrog Gigabit Ethernet chaw nres nkoj. Tsis tas li ntawd, yog tias koj xav tau ntau qhov chaw cia, koj yuav tsum tau siv cov hard drive sab nraud USB.

Hauv kab lus no koj tuaj yeem nyeem ntxiv txog NAS server yog dab tsi kom nkag siab zoo dua nws cov yam ntxwv.

Yuav ua li cas khiav DeepSeek R1 ntawm koj Raspberry Pi 5

Cov Khoom Siv Yuav Tsum Tau

Ua ntej koj pib hloov Raspberry Pi rau hauv NAS server, nco ntsoov tias koj muaj cov hauv qab no:

  • Una Txiv pos Pi 4 o Txiv pos Pi 5 (4GB lossis 8GB RAM version pom zoo).
  • Una microSD daim npav tsawg kawg yog 8 GB qhov twg peb yuav nruab lub operating system.
  • Fais fab adapter tau tshaj Raspberry Pi.
  • Un USB sab nraud hard drive los yog muaj peev xwm pendrives los khaws cov ntaub ntawv.
  • Un ethernet network cable (optional, tab sis pom zoo heev rau ntxiv stability).
  • Lub PC nrog Windows, macOS, lossis Linux los ua qhov pib configuration.

Txhim kho lub operating system ntawm Raspberry Pi

Thaum cov kev xav tau raug txheeb xyuas, peb tuaj yeem pib txheej txheem ntawm hloov Raspberry Pi rau hauv NAS server. Thawj qhov yuav tsum tau ua yog nruab ib lub teeb yuag operating system ntawm Raspberry Pi. Qhov kev xaiv zoo tshaj plaws rau qhov project no yog Raspberry Pi OS Lite. Txij li qhov OS no tsis suav nrog ib puag ncig graphical, kev ua tau zoo yog optimized. Nov yog cov kauj ruam ua raws li:

Cov ntsiab lus tshwj xeeb - Nyem qhov no  Nrhiav tus lej ntaus cim ntaus ntawv

1 Kauj Ruam: Rub tawm thiab nruab Raspberry Pi Imager, ib qho cuab yeej ua haujlwm uas yuav tso cai rau koj flash lub operating system mus rau microSD daim npav.

2 Kauj Ruam: Ntxig lub microSD rau hauv koj lub PC thiab qhib Raspberry Pi Imager. Xaiv Raspberry Pi OS Lite (64-ntsis yog tias koj Pi txhawb nws) thiab xaiv daim npav nco ua qhov chaw.

3 Kauj Ruam: Ua ntej sau cov duab, nkag mus rau cov kev xaiv siab heev thiab teeb tsa:

  • Lub hostname ntawm Raspberry Pi (piv txwv li, raspberrypi.loj).
  • Tus username thiab password.
  • Kev sib txuas Wi-Fi (yog tias koj tsis siv Ethernet).
  • Qhib SSH rau kev sib txuas ntawm cov chaw taws teeb.

4 Kauj Ruam: Nyem cov duab thiab, thaum cov txheej txheem ua tiav, ntxig daim npav microSD rau hauv Raspberry Pi thiab qhib nws.

Txij li thaum peb tau qhib SSH hauv qhov chaw, peb tuaj yeem tswj hwm Raspberry Pi yam tsis tas yuav txuas lub saib thiab cov keyboard. Los ntawm Windows, siv PuTTY; Ntawm macOS thiab Linux, tsuas yog qhib lub davhlau ya nyob twg thiab hom:

ssh user@raspberry_ip

Nkag mus rau tus password thiab koj yuav nkag mus rau pib teeb tsa.

Yuav ua li cas tig Raspberry Pi rau hauv NAS server hauv tsev

Teem lub hard drive sab nraud

Lwm cov kauj ruam tsim nyog los tig Raspberry Pi mus rau hauv lub tsev NAS server yog rau nruab ib lub USB nyuaj tsav raws li NAS thawj qhov chaw cia thiab tso cai rau nws tsim nyog.

Ua ntej koj yuav tsum xyuas seb lub npe twg tau muab rau lub disk nrog cov lus txib hauv qab no:

lsblk

Yog tias lub disk tsis formatted, koj tuaj yeem format nws ext4 nrog:

sudo mkfs.ext4 /dev/sda1

Tom qab ntawd txuas lub disk mus rau ib daim ntawv teev npe nkag tau:

sudo mkdir /mnt/nas
sudo mount /dev/sda1 /mnt/nas

Txhawm rau kom ntseeg tau tias lub disk tau raug ntsia rau ntawm qhov system reboot, hloov cov ntaub ntawv / etc / fstab nrog:

sudo nano / etc / fstab

Thiab ntxiv cov kab hauv qab no thaum kawg:

/dev/sda1 /mnt/nas ext4 defaults 0 2

Nruab thiab teeb tsa Samba

Txhawm rau muab cov ntaub ntawv hla lub network, peb yuav nruab Samba, software uas ua rau muaj kev sib txuas lus ntawm Windows thiab Linux systems.

sudo apt hloov tshiab && sudo apt nruab -y samba

Tam sim no kho koj cov ntaub ntawv configuration:

sudo nano /etc/samba/smb.conf

Ntxiv rau qhov kawg:

[NAS]
path = /mnt/nas
sau ntawv = muaj
tsim mask = 0777
npe mask = 0777
public = no

Txuag cov kev hloov pauv thiab rov pib qhov kev pabcuam:

sudo systemctl rov pib smbd

Nkag mus rau NAS los ntawm Windows lossis macOS

Tom qab tig Raspberry Pi rau hauv NAS server, ntawm no yog qhov koj yuav tsum tau ua kom nkag mus rau cov ntaub ntawv sib koom:

  • Ntawm qhov rais Qhib File Explorer thiab ntaus hauv qhov chaw nyob bar: \\raspberry_ip\NAS
  • Nyob rau macOS, qhib Finder thiab nias Cmd + K, ces ntaus: smb://raspberry_ip/NAS
Cov ntsiab lus tshwj xeeb - Nyem qhov no  Yuav ua li cas paub Ram ntawm kuv lub PC

Thaum kawg, nkag mus rau tus username thiab password uas koj tau teeb tsa yav dhau los thiab koj tuaj yeem tswj hwm cov ntaub ntawv los ntawm ib lub computer.

Raws li peb tau pom hauv kab lus no, ua tib zoo ua raws li cov kauj ruam, nws muaj peev xwm tig Raspberry Pi mus rau hauv tsev NAS server. A nthuav daws khaws thiab faib cov ntaub ntawv tsis siv nyiaj ntau.

Tshooj lej:
NAS server tsim yog dab tsi?