Centos 7 - How To Install NFS and Mount Remotely

Server Side Config

1.) First install nfs-utils

yum -y install nfs-utils

2.) Configure nfs share

Create a directory for your NFS share

mkdir /datastore

Create your NFS share in /etc/exports

echo "/datastore 10.220.101.0/24(rw,sync,no_root_squash)" >> /etc/exports
systemctl restart nfs

/etc/exports is where all NFS shares are defined

Allowed Client IP Range = 10.220.101.0/24

Read and Writing Allowed = rw

no_root_squash = makes it so the default of nobody is not used on the NFS share as a user (not secure in normal environments with user access but it makes sense for our situation)

sync = a good idea because otherwise the nfs server will reply to requests for unwritten/unstable data which can lead to corruption and data loss potentially.

Client Side

yum -y install nfs-utils

mount 10.10.2.20:/tmp/nfsmount /mnt/nfs/

IP of NFS Server = 10.10.2.20

NFS Share = /tmp/nfsmount

Local Mount Path = /mnt/nfs

Make it permanent with fstab

10.10.2.20:/tmp/nfsmount /mnt/nfs nfs defaults 0 0

Troubleshooting

Most issues are a result of a few things.

  1. You can't mount because nfs-utils was not installed on the client side.
  2. The IP range you specified is incorrect or invalid (if you are using NAT absolutely verify what the source IP from your client looks like to the server).
  3. Insecure ports issue if you are using NAT (you should set the "insecure" option
 rpc.mountd: refused mount request from somehostname.com for /some/path (/a/path/): illegal port 59201

If you get the above error you are probably using NAT somewhere between the client and server.  NAT mapping ends up resulting in high and so-called "insecure" ports to be used (I guess the fact that they are unprivileged and a non-root user could easly sniff or intercept on those ports). However if that's not a concern you modify your exports line like this:

/datastore 10.220.101.0/24(insecure,rw,sync,no_root_squash)


Tags:

centos, install, nfs, mount, remotely, utils, bcitcourse, yum, plugins, fastestmirror, kb, epel, _, metalink, extras, updates, updateinfo, primary_db, mb, eta, http, repo, virtualhosting, hk, repodata, dcc, ec, dec, ef, fb, bda, bd, db, primary, sqlite, bz, errno, unavailable, loading, speeds, cached, hostfile, ftp, cuhk, edu, jaist, ac, jp, resolving, dependencies, transaction, installed, processing, dependency, libtirpc, gssproxy, libnfsidmap, libevent, keyutils, libini_config, libverto, module, libref_array, ref_array_, ini_config_, libcollection, libbasicobjects, updated, update, libpath_utils, path_utils_, tevent, resolution, resolved, repository, installing, updating, summary, packages, upgrade, download, downloading, delta, rpms, disabled, usr, bin, applydeltarpm, rpm, os, succeeded, cleanup, verifying, configure, shares, defined, etc, exports, mkdir, datastore, echo, quot, rw, sync, no_root_squash, systemctl, restart,

Latest Articles

  • How To Upgrade Debian 8,9,10 to Debian 12 Bookworm
  • Linux dhcp dhclient Mint Redhat Ubuntu Debian How To Use Local Domain DNS Server Instead of ISPs
  • Docker dockerd swarm high CPU usage cause solution
  • Docker Minimum Requirements/How Efficient is Docker? How Much Memory Does Dockerd Use?
  • qemu-nbd: Failed to set NBD socket solution qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
  • apache2 httpd apache server will not start [pid 22449:tid 139972160445760] AH00052: child pid 23248 exit signal Aborted (6) solution Mint Debian Ubuntu Redhat
  • How to use the FTDI USB serial cable to RJ45 adapter to connect to the console on Cisco/Juniper Switch Router Firewall in Linux Ubuntu Debian Redhat
  • How To Setup Python3 in Ubuntu Docker Image for AI Deep Learning
  • How to Configure NVIDIA GPUs with Docker on Ubuntu: A Comprehensive Guide for AI Deep Learning CUDA Solution
  • Linux Ubuntu Mint how to check nameservers when /etc/resolv.conf disabled solution
  • Docker cannot work on other overlayfs filesystems such as ecryptfs won't start overlayfs: filesystem on '/home/docker/overlay2/check-overlayfs-support130645871/upper' not supported as upperdir
  • Linux How To Access Original Contents of Directory Mounted Debian Mint CentOS Redhat Solution
  • ecryptfs how to manually encrypt your existing home directory or other directory
  • How to Reset CIPC Cisco IP Communicator for CME CUCM CallManager
  • Internet Explorer Cannot Download File "Your security settings do not allow for this file to be downloaded." Security Settings Solution
  • Linux How To Upgrade To The Latest Kernel Debian Mint Ubuntu
  • Firefox how to restore and backup saved passwords and history which files/location
  • Linux How To echo as root solution to use tee permission denied solution Ubuntu Debian Mint Redhat CentOS
  • Linux how to keep command line bash process running if you are disconnected or need to logout of SSH remotely
  • Linux swapping too much? How to check the swappiness and stop swapping