How to Set Up Network-Attached Storage (NAS) in Debian 12 Bookworm System
Categories:
3 minute read
Introduction
Network-Attached Storage (NAS) is an essential component for both home and enterprise users who need centralized file storage and easy accessibility over a network. Setting up a NAS on Debian 12 “Bookworm” provides an efficient, cost-effective, and customizable storage solution. In this guide, we will go through the step-by-step process to set up a NAS using Debian 12 with Samba and NFS for seamless file sharing across different operating systems.
Prerequisites
Before proceeding with the setup, ensure you have the following:
- A Debian 12 “Bookworm” installed on a server or dedicated machine.
- At least one additional storage drive for shared storage.
- A stable network connection.
- Root or sudo privileges.
- Basic familiarity with Linux command-line operations.
Step 1: Update and Upgrade the System
First, update your Debian system to ensure all packages are current.
Reboot the system if necessary.
Step 2: Install Required Packages
To set up NAS functionality, we need to install either Samba for Windows and Linux compatibility or NFS for Linux-based file sharing.
Installing Samba (For Windows and Linux Clients)
Installing NFS Server (For Linux/Unix Clients)
Step 3: Configure Storage Drive
Identifying Storage Device
List available disks using:
Suppose your storage drive is /dev/sdb
, you need to partition and format it:
Format the partition:
Mount the partition:
To make this mount permanent, edit /etc/fstab
:
Step 4: Configure Samba for NAS
Creating a Shared Directory
Editing Samba Configuration
Open the Samba configuration file:
Add the following at the end of the file:
Create a Samba User
Restart Samba service:
Step 5: Configure NFS for NAS
Edit the NFS export file:
Add the following line:
Apply the changes:
Step 6: Configure Firewall and Network
Allow Samba and NFS through the firewall:
Enable the firewall:
Step 7: Access the NAS from Clients
Accessing Samba Share (Windows/Linux)
On Windows, open File Explorer and type:
\\<server-ip>\Shared
On Linux, mount the Samba share:
Accessing NFS Share (Linux)
Install NFS client:
Mount the NFS share:
To make it permanent, add this line to /etc/fstab
:
Conclusion
Setting up a NAS on Debian 12 “Bookworm” using Samba and NFS provides a reliable storage solution for sharing files across different operating systems. This guide covered everything from installation, configuration, and network setup to accessing shared storage. By following these steps, you can efficiently deploy a NAS system tailored to your needs.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.