How to create NFS


to create NFS server. we will need to install nfs-utils


---SERVER---

OS version : CENTOS 7
NFS version : fs-utils-1.3.0-0.33.el7.x86_64

1- Install the nfs utils.
Server > yum -y install nfs-utils

2- Start the server
Server > systemctl start nfs-server
Server > systemctl enable nfs-server
Server > systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
   Active: active (exited) since Thu 2018-01-04 15:05:38 MYT; 8s ago
 Main PID: 5363 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Jan 04 15:05:38 rhel73 systemd[1]: Starting NFS server and services...
Jan 04 15:05:38 rhel73 systemd[1]: Started NFS server and services.

3- Create new directory for sharing. you can skip this one if you want to share current folder
Server > mkdir /myshare

4- all nfs setting is stored on /etc/exports. so you can edit the file to add your share folder
Server >echo "/myshare *(rw)" >> /etc/exports #this will share the folder to all with RW permission.

5- execute the change
Server > exportfs -r

---DESKTOP---

in destop side you can mount the newly created NFS. you maybe need root to mount share folder.

Desktop > mount <serrver name @ IP>:/myshare /<your folder name>
Desktop > df -h /servershare/
Filesystem           Size  Used Avail Use% Mounted on
testserver:/myshare  6.8G  3.0G  3.5G  46% /servershare

Comments