Logon as “root” on CentOS :

[root@nfs ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

Install required package

Install “nfs-utils” :

[root@nfs ~]# yum install -y nfs-utils
---
---
---
Installed:
  nfs-utils.x86_64 1:1.3.0-0.21.el7_2.1

Dependency Installed:
  gssproxy.x86_64 0:0.4.1-8.el7_2       keyutils.x86_64 0:1.5.8-3.el7        libbasicobjects.x86_64 0:0.1.1-25.el7
  libcollection.x86_64 0:0.6.2-25.el7   libevent.x86_64 0:2.0.21-4.el7       libini_config.x86_64 0:1.2.0-25.el7
  libnfsidmap.x86_64 0:0.25-12.el7      libpath_utils.x86_64 0:0.2.1-25.el7  libref_array.x86_64 0:0.1.5-25.el7
  libtalloc.x86_64 0:2.1.5-1.el7_2      libtevent.x86_64 0:0.9.26-1.el7_2.1  libtirpc.x86_64 0:0.2.4-0.6.el7
  libverto-tevent.x86_64 0:0.2.5-4.el7  quota.x86_64 1:4.01-11.el7_2.1       quota-nls.noarch 1:4.01-11.el7_2.1
  rpcbind.x86_64 0:0.2.0-33.el7_2.1     tcp_wrappers.x86_64 0:7.6-77.el7

Complete!

Configure services

Start (and keep it started after a reboot) “rpcbind” :

[root@nfs ~]# systemctl start rpcbind && systemctl enable rpcbind

Start (and keep it started after a reboot) NFS server :

[root@nfs ~]# systemctl start nfs-server && systemctl enable nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.

Configure firewalld

Open services :

[root@nfs ~]# firewall-cmd --permanent --add-service=nfs --add-service=rpc-bind --add-service=mountd
success

Activate the configuration :

[root@nfs ~]# firewall-cmd --reload
success

Export filsystems

Add mount point to export in “/etc/exports” :

[root@nfs ~]# cat /etc/exports
# Here is an simple example :
/data   192.168.1.0/24(rw,sync,no_subtree_check)

And export defined mount points :

[root@nfs ~]# exportfs -av
exporting 192.168.1.0/24:/data

This mount point is now exported :

[root@nfs ~]# showmount -e
Export list for nfs:
/data 192.168.1.0/24

On NFS client side

We can mount this export filesystem :

[root@client ~]# mount 192.168.1.158:/data /mnt

Because our I.P. address is authorized :

[root@client ~]# ip addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether f6:2f:e3:7f:8a:26 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.159/24 brd 192.168.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::f42f:e3ff:fe7f:8a26/64 scope link
       valid_lft forever preferred_lft forever

 

PDF24    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*