This script automates the setup process for creating a Network-Attached Storage (NAS) server using a Raspberry Pi. It installs necessary packages, mounts an external drive for storage (which you select), configures a Samba share for file sharing.
- Raspberry Pi running Raspberry Pi OS (I went with legacy 64 bit lite)
- External storage device (SSD or hard drive)
Before running the script, make sure to adjust the configuration variables in the script according to your preferences (can leave default):
MOUNT_POINT
: The directory where the external drive will be mounted.SHARE_NAME
: The name of the Samba share.USER_NAME
: Pi username. pi by default.GROUP_NAME
: Pi groupname. pi by default.
git clone https://github.com/MrLately/pi_nas.git
cd pi_nas
chmod +x pi_nas.sh
sudo ./pi_nas.sh
I ran these after setup because they are what i wanted, you may want different:
mkdir -p /mnt/nas/Movies
mkdir -p /mnt/nas/Series
mkdir -p /mnt/nas/Pictures
mkdir -p /mnt/nas/Documents
To edit the SAMBA config further run:
sudo nano /etc/samba/smb.conf
Once the setup is complete, you can access the Samba share from any device on your network. Use the following steps:
- Open File Explorer (Windows) or Finder (macOS).
- Enter the following address in the address bar:
\RASPBERRY_PI_IP\SHARE_NAME
Replace
RASPBERRY_PI_IP
with the IP address of your Raspberry Pi andSHARE_NAME
with the configured share name.
![gh](https://private-user-images.githubusercontent.com/94589563/319239260-483a8e53-77b5-4900-86c6-9aa2a09f86fb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1NTU4ODUsIm5iZiI6MTcyMzU1NTU4NSwicGF0aCI6Ii85NDU4OTU2My8zMTkyMzkyNjAtNDgzYThlNTMtNzdiNS00OTAwLTg2YzYtOWFhMmEwOWY4NmZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRf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