Mount NFS Share (CentOS 7)

Robert Andresen Tutorials Leave a Comment

I have a SMS Gateway installed on a Windows 2008 server at my work, that recieve and sends SMS by .txt files in a folder.

To access the SMS files on my webserver and added a NFS mount to the SMS-folder into my webpage root.

Create the NFS share on Windows server

win_rights_nfs_share

Install NFS tools on CentOS 7

[code]yum install nfs-utils nfs-utils-lib[/code]

Enable and start NFS services:

[code]systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap[/code]

Start the NFS services:

[code]systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap[/code]

 

To create a static mount, that mount on every startup – we need to add the mount in the fstab file.

[code]vi /etc/fstab[/code]

[code]# # /etc/fstab # Created by anaconda on Tue Aug 19 12:15:24 2014 # # Accessible filesystems, by

/dev/mapper/centos-swap swap                    swap    defaults        0 0 192.168.1.101:/var/unixmen_share/ /var/nfs_share/ nfs rw,sync,hard,intr 0 0
<SERVER IP/HOSTNAME>:/SysManSMS/ /var/www/html/SysManSMS/ nfs[/code]

 

Remount without restart
[code]# mount -a[/code]

 

Possible error messages

If the linux server IP/Hostname is not added in NFS permissions on the Windows server:

[code]mount.nfs: access denied by server while mounting S1000-2AM-9999:/SysManSMS[/code]

If NFS service is not installed or running

[code]mount: mount point /var/www/html/external/SysManSMS/ does not exist[/code]