Installing and Configuring NFS Server on RHEL7

configure nfs server linux, installing nfs server linux, setup nfs server linux, How to set up nfs server on Linux, how to configure nfs in linux

The main purpose of this article is to explain the below things,

What is NFS (Network File System)?
What is required?
How to Install NFS?
How to Configure NFS Server?
How to mount NFS share on client?

What is NFS?

A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.

What is Required?

nfs-utils and rpcbind packages at the server end.

How to Install NFS Server?

Install the required packages using YUM as follows, if YUM not configured please visit the link How to Configure Local YUM Repo Server in Linux
[root@server1 ~]# yum -y install nfs-utils rpcbind

Installing and Configuring NFS Server on Linux

Before configuring the NFS Server, start and enable the rpcbind and nfs services.
[root@server1 ~]# systemctl start rpcbind
[root@server1 ~]# systemctl start nfs
There are two ways to configure an NFS server:

1. Manually editing the NFS configuration file, that is, /etc/exports, and
2. through the command line, that is, by using the command exportfs.

Editing the /etc/exports Configuration File:

The /etc/exports file controls which file systems are exported to remote hosts and specifies options. It follows the following syntax rules:

  1. Blank lines are ignored.
  2. To add a comment, start a line with the hash mark (#).
  3. You can wrap long lines with a backslash (\).
  4. Each exported file system should be on its own individual line.
  5. Any lists of authorized hosts placed after an exported file system must be separated by space characters.
  6. Options for each of the hosts must be placed in parentheses directly after the host identifier, without any spaces separating the host and the first parenthesis.

Each entry for an exported file system has the following structure:
export host(options)
The structure uses the following variables:

export - The directory being exported
host - The host or network to which the export is being shared
options - The options to be used for host

It is possible to specify multiple hosts, along with specific options for each host. To do so, list them on the same line as a space-delimited list, with each hostname followed by its respective options (in parentheses), as in:
export host1(options1) host2(options2) host3(options3)
In our scenario we define two hosts and one share folder /mydata which we use to export to the client:

NFS Server, IP
NFS Client, IP

At Server End Configuration:

Edit the configuration file,
[root@server1 ~]# vi /etc/exports
Add the below list of folders as follows to be exported and file looks like below,
[root@server1 ~]# cat /etc/exports
/mydata *(rw)

Issue the below command  to reread to Re-export all NFS directories:
[root@server1 ~]# exportfs -ra
Check the configuration as follows to ensure the newly added settings:
[root@server1 ~]# showmount -e
Export list for
/mydata *
[root@server1 ~]#
Server end configuration is done.

At Client End Configuration:

Login into the client and verify the nfs shared volumes using the below command.
[root@client1 ~]# showmount -e
Export list for
/mydata *
[root@client1 ~]#
Mount the NFS volume:
[root@client1 ~]# mount /mnt/
[root@server1 ~]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root          7.5G  5.0G  2.6G  67% /
devtmpfs                       108M     0  108M   0% /dev
tmpfs                          118M     0  118M   0% /dev/shm
tmpfs                          118M  8.6M  109M   8% /run
tmpfs                          118M     0  118M   0% /sys/fs/cgroup
/dev/sda1                      497M  119M  379M  24% /boot
/dev/mapper/VolGroup00-lvol00  4.8G   20M  4.6G   1% /mydata            4.8G   20M  4.6G   1% /mnt

That's it, we are done with NFS Server configuration at both server and client end. configure nfs server linux, installing nfs server linux, setup nfs server linux, How to set up nfs server on Linux, Configuring nfs, how to configure nfs in linux
Please share and follow us to not miss any updates and leave your comment. Thank You. configure nfs server centos 6, configure nfs server rhel 7, configure nfs server in linux, configure nfs server and client in linux, configure nfs server centos 7, how to configure nfs server in redhat linux 6, how to configure nfs server in aix, how to configure nfs server in linux step by step, install nfs server centos 6, install nfs server centos 7, install nfs server redhat, install nfs server rhel7, install nfs server rhel
August 16, 2015

Post a Comment


Contact Form


Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget