https://github.com/nikoo-asadnejad/linux-nfs-filesharing
https://github.com/nikoo-asadnejad/linux-nfs-filesharing
linux nfs nfs-client nfs-server
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nikoo-asadnejad/linux-nfs-filesharing
- Owner: Nikoo-Asadnejad
- Created: 2025-01-02T09:06:18.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-01-02T14:16:51.000Z (4 months ago)
- Last Synced: 2025-01-16T03:46:31.355Z (3 months ago)
- Topics: linux, nfs, nfs-client, nfs-server
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Setting Up an NFS Server on Linux
## Update the package repository.
```bash
sudo apt update # For Ubuntu/Debian
sudo yum update # For CentOS/RHEL
```## Install NFS server
```bash
sudo apt install nfs-kernel-server -y # For Ubuntu/Debian
sudo yum install nfs-utils -y # For CentOS/RHEL
```## Create shared directory and set permissions
```bash
sudo mkdir -p /mnt/shared_nfs
sudo chmod 777 /mnt/shared_nfs # Adjust permissions as needed
```## Configure NFS exports
```bash
sudo nano /etc/exports/mnt/shared_nfs 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
```- rw: Read/write access.
- sync: Write changes synchronously to disk.
- no_subtree_check: Disables subtree checking for better performance.
- no_root_squash: Allows root access on the client (use with caution).## Export shared directories
```bash
sudo exportfs -arv
```## Start NFS server
```bash
sudo systemctl start nfs-server # For Ubuntu/Debian
sudo systemctl start nfs # For CentOS/RHEL
```## Enable NFS server on boot
```bash
sudo systemctl enable nfs-server # For Ubuntu/Debian
sudo systemctl enable nfs # For CentOS/RHEL
```## Open NFS ports for a subnet (Optional)
```bash
sudo ufw allow from 192.168.1.0/24 to any port nfs # For Ubuntu with UFW
sudo firewall-cmd --add-service=nfs --permanent # For CentOS/RHEL
sudo firewall-cmd --reload
```## Verify NFS exports
```bash
sudo exportfs -v
```## Install NFS client package
```bash
sudo apt install nfs-common -y # For Ubuntu/Debian
sudo yum install nfs-utils -y # For CentOS/RHEL
```## Mount the NFS share
```bash
sudo mount server-ip:/mnt/shared_nfs /mnt
```## Verify the mount
```bash
df -h
```