Fedora 26: Install nfs-utils for NFS server


Table of Contents

1 Install nfs-utils

Install nfs-utils package.

$ sudo dnf install -y nfs-utils$ sudo firewall-cmd –add-service=nfs –permanent$ sudo firewall-cmd –reload$ sudo systemctl enable nfs$ sudo systemctl restart nfs

2 Export directory to NFS

/etc/exportfs is written exported directories to NFS.

$ cat /etc/exports<path> <ipaddr>(<option>)

Update exported directories to NFS.

$ sudo exportfs -ra

2.1 Exported directory for nfsroot

  • no_root_squash will use UID and GID of client for file access by client.
  • If UID and GID is shared by LDAP, use no_root_squash.
  • If using nfsroot for booting root filesystem, use no_root_squash.
  • subtree_check checks if file access by client is inside exported directory. no_subtree_check disable this check for performance.

$ cat /etc/exports/var/lib/nfsroot 192.168.11.0/24(rw,sync,no_root_squash,no_subtree_check)$ sudo mkdir /var/lib/nfsroot$ sudo exportfs -ra

2.2 Exported directory for file sharing

  • root_squash uses nobody:nogroup for file access by client.

$ cat /etc/exports/var/lib/nfsshare *(rw,sync,root_squash,subtree_check)$ sudo mkdir /var/lib/nfsshare$ sudo chmod 777 /var/lib/nfsshare$ sudo exportfs -ra

3 Mount NFS

Mount NFS with mount.nfs.

$ sudo mount -t nfs 127.0.0.1:/var/lib/nfsshare /mnt

Android | Linux | SDL - Narrow Escape