WHAT IS NFS SERVER AND HOW TO CONFIGURE NFS SERVER IN LINUX.

 

NFS(Network File System) is  basically a distribute File System Protocol which is used to share data over network , allowing a user on a client computer to access files over a computer network much like local storage is accessed.The client system just needs to be running an NFS client compatible with the NFS server. Client accesses the remote file system as if it were local.because access is granted by IP address, a username and password are not required. However, there are security risks to consider because the NFS server knows nothing about the users on the client system.

nfs server

Follow these steps to configure Nfs server:

First we will install packages which is required for nfs.

[root@localhost ~]# yum install nfs*

Loaded plugins: rhnplugin, security
Repository 'a' is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
a                                                                                      | 1.3 kB     00:00
Setting up Install Process
Package nfs-utils-lib-1.0.8-7.6.el5.i386 already installed and latest version
Package 1:nfs-utils-1.0.9-42.el5.i386 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils-lib-devel.i386 0:1.0.8-7.6.el5 set to be updated
---> Package nfs4-acl-tools.i386 0:0.3.3-1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================
 Package                            Arch                Version                        Repository        Size
==============================================================================================================
Installing:
 nfs-utils-lib-devel                i386                1.0.8-7.6.el5                  a                 57 k
 nfs4-acl-tools                     i386                0.3.3-1.el5                    a                 44 k
Transaction Summary
==============================================================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 101 k
Is this ok [y/N]: y
  • It will calculate file size and you whether you wanna download it or not. Type y and hit ENTER.
Downloading Packages:
--------------------------------------------------------------------------------------------------------------
Total                                                                         2.7 MB/s | 101 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : nfs-utils-lib-devel                                                                    1/2
  Installing     : nfs4-acl-tools                                                                         2/2
Installed:
  nfs-utils-lib-devel.i386 0:1.0.8-7.6.el5                  nfs4-acl-tools.i386 0:0.3.3-1.el5
Complete!
  • Also install this package .
[root@localhost ~]# yum install portmap*

Loaded plugins: rhnplugin, security
Repository 'a' is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package portmap-4.0-65.2.2.1.i386 already installed and latest version
Nothing to do
  • Now create a foler to share to client machine which will be used in nfs server.
[root@localhost ~]# mkdir /share

Then we will changes in etc/exports is basically a file , controls which file systems are exported to remote host or remote client machines.

[root@localhost ~]# vim /etc/exports
  • In this file i’m giving allowance to only one client (ip address of client) to read and write. And sync command is used if admin or client make changes can be seen by both. /share is a folder that is seen by both admin and client under nfs server
/share  192.168.0.107(rw,sync)
~
~
~
~

OR

/share  *(rw,sync)  :This will share data to everyone connected with the NFS server.

/share  *(rw,sync)
~
~
~
~
  • Press ESC and type :wq (to save and quiet)
~
~
:wq
  • After making changes we have to start the nfs service
[root@localhost ~]# service portmap restart

Stopping portmap:                                          [  OK  ]
Starting portmap:                                          [  OK  ]
  • Remember to start the service after you make the change
[root@localhost ~]# service nfs restart

Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
  • Its time to share folder created on nfs service to client machine using exports command .
[root@localhost ~]# exportfs -a

exportfs: No options for /share 192.168.0.0/255.255.255.0: suggest 192.168.0.0/255.255.255.0(sync) to avoid warning
exportfs: No host name given with /share (rw,sync), suggest *(rw,sync) to avoid warning
  • Make sure your firewall and security enhance is disabled . Use this command to disable.
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
  • Check which of your folder is ready to share over nfs server using showmount command.
[root@localhost ~]# showmount -e 192.168.0.107

Export list for 192.168.0.107:
/share *

Now comes the client role

  • To read and write the folder client have to mount it to the clients folder.
  • -t is used for which type of file.
  • nfs ( is a type of file we are using)
  • Then give ip address of client machine:/folder name that has been shared
  • Then path where you want to mount.
[root@localhost ~]# mount -t nfs 192.168.0.107:/share /root/Desktop/D
  • You ca check by this command whether its been mounted or not.
[root@localhost ~]# df -h
  • This is command is used by admin to refresh if he makes any changes any  etc/exports file.
[root@localhost ~]# exportfs -r
  • Try whether its been working or not. Create files
[root@localhost share]# touch {a..z}.txt
[root@localhost share]# ls

a.txt  c.txt  e.txt  g.txt  i.txt  k.txt  m.txt  o.txt  q.txt  s.txt  u.txt  w.txt  y.txt
b.txt  d.txt  f.txt  h.txt  j.txt  l.txt  n.txt  p.txt  r.txt  t.txt  v.txt  x.txt  z.txt
  • Admin will be able to see the files. If admin put any any file in this folder can been seen by client too.

Now if you want to stop the nfs server write this command.

[root@localhost ~]# service nfs stop

YUM SERVER CONFIGURATION IN WINDOWS.

HOW TO BREAK FILE INTO MANY FILES TO SECURE YOUR DATA IN LINUX

HOW TO COMBINE FILES IN A SINGLE FILE AND HOW TO COMPRESS FILE IN LINUX

2 thoughts on “WHAT IS NFS SERVER AND HOW TO CONFIGURE NFS SERVER IN LINUX.

  1. I was suggested this blog through my cousin. I’m no longer sure whether this
    publish is written by him as nobody else recognise such unique about my difficulty.
    You are wonderful! Thank you!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s