Skip to content

Instantly share code, notes, and snippets.

@prasanjit-
Created June 18, 2017 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prasanjit-/e69ed9224f0255cc6bbe2954aef0649c to your computer and use it in GitHub Desktop.
Save prasanjit-/e69ed9224f0255cc6bbe2954aef0649c to your computer and use it in GitHub Desktop.
NFS-Server_Client Deployment
:: NFS ::
NFS, stands for Network File System, is a server-client protocol used for sharing files between linux/unix to unix/linux systems. NFS enables you to mount a remote share locally. You can then directly access any of the files on that remote share.
- Test Nodes:
NFS Server Hostname: server1
NFS Server IP Address: 192.168.1.104/24
NFS Client Hostname: server2
NFS Client IP Address: 192.168.1.102/24
- Install NFS packages in your Server system by using the following command:
yum install nfs-utils nfs-utils-lib
- Enable and start NFS services:
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap
- Now, let us create some shared directories in server.
.Create a shared directory named ‘/var/network_share’ in server and let the client users to read and write files in that directory.
mkdir /var/network_share
chmod 777 /var/network_share/
-Export shared directory on NFS Server:
Edit file /etc/exports,
vi /etc/exports
- Add the following line:
/var/network_share/ 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)
where,
/var/network_share – shared directory
192.168.1.0/24 – IP address range of clients
rw – Writable permission to shared folder
sync – Synchronize shared directory
no_root_squash – Enable root privilege
no_all_squash - Enable user’s authority
- Restart the NFS service:
systemctl restart nfs-server
- Client Side Configuration
- Install NFS packages in your client system by using the following command:
yum install nfs-utils nfs-utils-lib
- Enable and start NFS services:
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap
- Mount NFS shares On clients
Create a mount point to mount the shared folder ‘/var/network_share’ which we’ve created before in the server.
mkdir /var/nfs_share
Mount the share from server to client as shown below
mount -t nfs 192.168.1.104:/var/network_share/ /var/nfs_share/
- Permanent Mount
Add entry in /etc/fstab
To stop services:
systemctl stop rpcbind
systemctl stop nfs-server
systemctl stop nfs-lock
systemctl stop nfs-idmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment