HOME RESTORATION DIGITAL PHOTOS DIGITAL BOOKS PROFESSIONAL HISTORY CONTACT ME


CentOS 7 Installing an NFS Server

Domain name: example.com     Realm name: EXAMPLE.COM

Workgroup: EXAMPLE     Server IP address: xx.xx.xx.xx

Server name: linuxsvr01     Client name: linuxclnt01

Root password: ?Pa55w0rd!

Until I started with Citrix XenServer I had not come across NFS, on reading about this file level sharing system I now know why! Having been a Windows person it was only with the launch of Windows 7 (Enterprise/Ultimate versions) that Microsoft introduced Services for NFS and the Client for NFS. So if you have Windows 8.1 and later you can use NFS rather than SMB (Samba), my research suggests that NFS wins in benchmark tests over SMB, especially with small to medium file sizes.

The following are the steps necessary to set up an NFS Server on CentOS 7.

Firstly let's install the packages that are needed.

# yum -y install nfs-utils libnfsidmap

Depending on your install of CentOS 7 (minimum or other) these packages may already be installed, no problem they will not be reinstalled.

Open the idmspanapd.conf and uncomment line 5 and change it to your domain name

# vi /etc/idmapd.conf
    Domain = example.com

This was a new install of CentOS 7 and I had already created a mount called /nfs using 2 x 1 TB drives so I had no need to create or mount an nfs file share folder. All that was necessary was to change the permissions of the share as follows:

# chmod 777 /nfs/

Now we must modify the exports file, this was a new install and the file was empty so we can add the following entry

# vi /etc/exports
    /nfs xx.xx.xx.0(rw,sync,no_root_squash)

where xx.xx.xx.0 is the is the client network, eg. server is 10.0.0.10 and the clients are 10.0.0.11 and 10.0.0.12

The changes made in the exports file must be saved by creating an NFS table that holds the exports of your shares using the following command

# exportfs -r

Make sure that rpcbind (required for import/export of NFS shares) and nfs-server are started and also enabled at boot

# systemctl start rpcbind nfs-server
# systemctl enable rpcbind nfs-server

As usual we must configure the firewall

# firewall-cmd --permanent --zone=public --add-service=mountd
# firewall-cmd --permanent --zone=public --add-service=rpc-bind
# firewall-cmd --permanent --zone=public --add-service=nfs
# firewall-cmd --reload

To configure the windows machines to mount the NFS file shares you must install the Client for NFS. On Windows Server it is achieved through Add Roles and Features and on Windows 7, 8 and 10 it is through Control PanelProgramsTurn features on or off.