$ sudo yum install nfs-utils
$ sudo systemctl enable rpcbind
$ sudo systemctl enable nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
- Replace [example.tld], [192.168.xx.xxx], [UID], and [GID] for each entry.
- Ensure UID and GID match on NFS server and client!
$ sudo nano /etc/exports
And Add
/var/www/html/vhosts/[example.tld]/wwwroot/pub [192.168.xx.xxx](rw,insecure,nohide,sync,anonuid=[UID],anongid=[GID],no_subtree_check) [192.168.xx.xxx](rw,insecure,nohide,sync,anonuid=[UID],anongid=[GID],no_subtree_check)
/var/www/html/vhosts/[example.tld]/wwwroot/var [192.168.xx.xxx](rw,insecure,nohide,sync,anonuid=[UID],anongid=[GID],no_subtree_check) [192.168.xx.xxx](rw,insecure,nohide,sync,anonuid=[UID],anongid=[GID],no_subtree_check)
/var/www/html/vhosts/[example.tld]/wwwroot/generated [192.168.xx.xxx](rw,insecure,nohide,sync,anonuid=[UID],anongid=[GID],no_subtree_check) [192.168.xx.xxx](rw,insecure,nohide,sync,anonuid=[UID],anongid=[GID],no_subtree_check)
$ sudo systemctl restart nfs-server
$ sudo exportfs
/var/www/html/vhosts/[example.tld]/wwwroot/pub [192.168.xx.xxx]
/var/www/html/vhosts/[example.tld]/wwwroot/var [192.168.xx.xxx]
/var/www/html/vhosts/[example.tld]/wwwroot/generated [192.168.xx.xxx]
$ sudo reboot
Connection to [hostname.example.tld] closed by remote host.
Connection to [hostname.example.tld] closed.
$ sudo systemctl status nfs-server
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since Fri 2018-07-13 18:26:26 PDT; 2min 56s ago
Process: 1280 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Main PID: 1280 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/nfs-server.service
Jul 13 18:26:25 [hostname.example.tld] systemd[1]: Starting NFS server and services...
Jul 13 18:26:26 [hostname.example.tld] systemd[1]: Started NFS server and services.
$ sudo systemctl status rpcbind
● rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-07-13 18:26:23 PDT; 3min 56s ago
Main PID: 732 (rpcbind)
CGroup: /system.slice/rpcbind.service
└─732 /sbin/rpcbind -w
Jul 13 18:26:23 [hostname.example.tld] systemd[1]: Starting RPC bind service...
Jul 13 18:26:23 [hostname.example.tld] systemd[1]: Started RPC bind service.
$ sudo exportfs
/var/www/html/vhosts/[example.tld]/wwwroot/pub [192.168.xx.xxx]
/var/www/html/vhosts/[example.tld]/wwwroot/var [192.168.xx.xxx]
/var/www/html/vhosts/[example.tld]/wwwroot/generated [192.168.xx.xxx]
$ sudo yum install nfs-utils
- Replace [example.tld] and [192.168.xx.xxx] for each entry.
$ sudo nano /etc/fstab
Append to bottom of file:
...
[192.168.xx.xxx]:/var/www/html/vhosts/[example.tld]/wwwroot/pub /var/www/html/vhosts/[example.tld]/wwwroot/pub nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800,_netdev 0 0
[192.168.xx.xxx]:/var/www/html/vhosts/[example.tld]/wwwroot/var /var/www/html/vhosts/[example.tld]/wwwroot/var nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800,_netdev 0 0
[192.168.xx.xxx]:/var/www/html/vhosts/[example.tld]/wwwroot/generated /var/www/html/vhosts/[example.tld]/wwwroot/generated nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800,_netdev 0 0
- It will throw an error if there is a problem
$ sudo mount -a
$ sudo reboot
Connection to [hostname.example.tld] closed by remote host.
Connection to [hostname.example.tld] closed.
$ df -h
Filesystem Size Used Avail Use% Mounted on
...
tmpfs 782M 0 782M 0% /run/user/1001
192.168.xx.xxx:/var/www/html/vhosts/[example.tld]/wwwroot/pub 94G 8.1G 86G 9% /var/www/html/vhosts/[example.tld]/wwwroot/pub
192.168.xx.xxx:/var/www/html/vhosts/[example.tld]/wwwroot/var 94G 8.1G 86G 9% /var/www/html/vhosts/[example.tld]/wwwroot/var
192.168.xx.xxx:/var/www/html/vhosts/[example.tld]/wwwroot/generated 100M 8.1G 86G 0% /var/www/html/vhosts/[example.tld]/wwwroot/generated
Check NFS Client Statistics
**** The goal is to have 0 retransmisions.
Check NFS Server Statistics
**** The goal is to have 0 bad calls from the clients.
Update Server Thread Count