From 5e3d651660736ee41f02baa60f11661d9d6b8d3d Mon Sep 17 00:00:00 2001 From: radinpirouz Date: Wed, 9 Apr 2025 15:24:55 +0200 Subject: [PATCH] added nfs document --- Storage/NFS/setup.md | 121 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Storage/NFS/setup.md diff --git a/Storage/NFS/setup.md b/Storage/NFS/setup.md new file mode 100644 index 0000000..7af2176 --- /dev/null +++ b/Storage/NFS/setup.md @@ -0,0 +1,121 @@ +# 📡 NFS Server & Client Setup Guide (Ubuntu) + +Easily set up a Network File System (NFS) for sharing files between Linux systems on the same network. + +--- + +## 🖥️ Server Configuration (Ubuntu) + +### 1. Install NFS Kernel Server + +Install the required package: + +```bash +sudo apt update +sudo apt install nfs-kernel-server +``` + +### 2. Create a Shared Directory + +Replace `` with your preferred path: + +```bash +sudo mkdir -p +sudo chown nobody:nogroup +sudo chmod 777 +``` + +> ✅ *Best practice:* Use a dedicated directory for NFS shares, e.g., `/srv/nfs/shared`. + +### 3. Configure NFS Exports + +Create an exports configuration file: + +```bash +sudo vim /etc/exports.d/shared.exports +``` + +Add the following line (update paths and IPs accordingly): + +``` + (rw,sync,no_root_squash,no_subtree_check) +``` + +> 💡 **Notes:** +> - ``: Full path to the directory you want to share +> - ``: IP address of the client allowed to access the share + +### 4. Apply Export Changes + +```bash +sudo exportfs -ra +``` + +### 5. Enable and Restart NFS Service + +```bash +sudo systemctl enable nfs-server +sudo systemctl restart nfs-server +``` + +--- + +## 💻 Client Configuration (Ubuntu) + +### 1. Install NFS Client Packages + +```bash +sudo apt update +sudo apt install nfs-common rpcbind +``` + +### 2. Create a Mount Point + +Choose a local directory to mount the share (e.g., `/mnt/nfs`): + +```bash +sudo mkdir -p +sudo chmod 777 +``` + +### 3. Mount the NFS Share (Temporary) + +```bash +sudo mount -t nfs : +``` + +> Example: +> `sudo mount -t nfs 192.168.0.10:/srv/nfs/shared /mnt/nfs` + +### 4. Enable Auto-Mount at Boot + +Edit the fstab file: + +```bash +sudo vim /etc/fstab +``` + +Add this line: + +``` +: nfs defaults 0 0 +``` + +> Example: +> `192.168.0.10:/srv/nfs/shared /mnt/nfs nfs defaults 0 0` + +### 5. Verify and Reload Mounts + +```bash +sudo mount -a +``` + +--- + +## ✅ Final Checklist + +- 🔄 NFS server and client packages installed +- 📁 Shared and mount directories properly set +- 🔐 Permissions and access IPs correctly configured +- ⚙️ Auto-mount enabled with `/etc/fstab` +