# NFS

## <span class="mw-headline" id="bkmrk-installation-%26-setup-1">NFS</span>

(Guidance based on RHEL/CentOS 7, packages and commands may differ depending on OS)

<span class="TextRun SCXO41186676 BCX0" data-contrast="none" lang="EN-US" xml:lang="EN-US"><span class="NormalTextRun SCXO41186676 BCX0">====================================================================================</span></span>

### NFSSHARE SERVER CONFIGURATION

#### 1. Install NFS packages on NFS Server

```
yum install nfs-utils rpcbind
```

#### 2. Start on-boot

If this is **not** a cluster then start these at boot time:

```
systemctl enable --now rpcbind nfs-server nfs-lock nfs-idmap
```

#### 3. exports

Once installed, we can look to configure the nfs share within the /etc/exports file:

```
vim /etc/exports
```

Add the below config (updated with IP of the client server that need to be able to access the nfsshare.

```
/nfsshare IP_IP_IP_IP(rw,sync,no_root_squash)
```

To specify multiple client servers, add separate lines, as below:

```
/nfsshare IP_IP_IP_IP(rw,sync,no_root_squash)
/nfsshare IP_IP_IP_IP(rw,sync,no_root_squash)
/nfsshare IP_IP_IP_IP(rw,sync,no_root_squash)
```

Once added, you can publish the exports changes using the below command:

```
exportfs -a
```

**<span class="TextRun SCXO41186676 BCX0" data-contrast="none" lang="EN-US" xml:lang="EN-US"><span class="NormalTextRun SCXO41186676 BCX0">=================================================================================</span></span>**

### NFS CLIENT CONFIGURATION 

#### 1. Install the required NFS packages:

```
yum install nfs-utils
```

#### 2. Mount the NFSSHARE (won't persist reboot until next step):

Firstly, create the file path that you wish for the NFSSHARE to be mounted to:

```
mkdir /nfsshare 
```

The below command mounts the NFSSHARE. Ensure to replace the IP\_IP\_IP\_IP:nfsshare with the NFS server IP, and location of the NFSSHARE on the NFS server. Finally, also ensure to update the second /nfsshare on the command to the path you wish for the share to be mounted to on the client server.

```
mount -t nfs IP_IP_IP_IP:/nfsshare /nfsshare
```

#### 3. Test the configuration

Test that mounting the nfsshare has worked using the df -h command. You should now see an entry dedicated to the NFSSHARE, as below:

#### 4. Permanently configure the NFSSHARE

Once you've confirmed that the NFSSHARE is working, you can then look to add the fstab entry that will allow this configuration to persist time &amp; reboots.

```
vim /etc/fstab
```

Add the below link, ensuring the update the syntax as mentioned [above](https://bookstack.b4sed.xyz/link/57#bkmrk-the-below-command-mo)

```
IP_IP_IP_IP:/nfsshare /nfsshare nfs rw,relatime,vers=4,_netdev,timeo=100,retrans=4 0 0
```

Once you've added this, ensure that this is now working by forcing all fstab-configured mounts to mount:

```
mount -a
```