Thursday, May 7, 2020

Configuration of Network- File-Sharing(NFS)


 Hello friends, today i am going to share you how to perform Network file sharing (NFS) on centos7 system. This configurations are mainly used for linux to linux machin files sharing.
File sharing steps are given below:
You will required 2 systems to perform the above mentioned configuration. If suppose, you have windows machine with you.Then by using virtualbox/vmware install centos7 or redhat7.Then consider one system of centos as a server & other as a client.
1)Install nfs package on server side by using command sudo yum install nfs*
install nfs package on client side by using command sudo yum install nfs-utils
2)Linux is very secure because it provides 3 layers of security like root,firewall,selinux.
Now disable selinux on both server & client side.
Steps to disabled selinux: Edit below mentioned configuration file.
i)vi /etc/selinux/config
 selinux=disabled
ii)reboot - then reboot the system.
iii) getenforce - check selinux is disabled or not by using getenforce command, output should be disabled.
3) STOP firewall as below:
Check the firewall status by using systemctl status firewalld command.
Stop the firewall by using systemctl stop firewalld.
4) Steps to perform server side:
i) Make new directory onto /mnt file as Mkdir /mnt/nfs1
change the directory by using command cd /mnt/nfs1
create empty files by using command touch 1 2 3 4 . This will create 1, 2, 3 & 4 empty files.
Edit file 1 as vi 1 and write the file like This is my nfs file.
5) Edit /etc/exports file as below:
i) vi /etc/exports then press enter write below content like
ii) /mnt/nfs1 * (rw,sync) where * indicates all ip addresses
iii) Change the permissions of /mnt/nfs1 file.
  chmod 777 /mnt/nfs1
6) Then, Start nfs service by using systemctl start nfs command.
7) Check the firewall status again, if firewalld is not stopped then stop it again by using systemctl stop firewalld
8) write exportfs-av command you will get output as below.
9) Check the ip address by using hostname –I
10) Steps to perform at client side:
i) mount 192.168.1.100:/mnt/nfs1 /mnt
11) Check the connectivity from client to server side by using ping command as ping 192.168.1.100
Where 192.168.1.100 is a server ip.
If ping is successful that means file sharing is successful.
12) at client side change directory to mnt by using cd /mnt, Then list the files associated with respective directory. You will get output as below.
Then Cat 1 you will get output as below.
If any error observer do the changes into network as bridge adapter on both system.
Thanks for reading above blog.

No comments:

Post a Comment

If you have any doubts. Please let me know.