NFS
(Network File System) is a distributed network file sharing system protocol. It
is provides to share files and folders between Linux distributions over the
network.
This
article describes How to Configure NFS Server on CentOS7.
NFS Server Configuration:
Step 1. Package installation:
NFS Server package is available in CentOS7 base repository. Run the following command to install NFS Server
packages:
[root@lc-nfsserver ~]#
yum install nfs-utils
Loaded plugins:
fastestmirror
………………..
Installed:
nfs-utils.x86_64 1:1.3.0-0.65.el7
Dependency Installed:
gssproxy.x86_64 0:0.7.0-26.el7 keyutils.x86_64 0:1.5.8-3.el7
………………..
quota-nls.noarch 1:4.01-19.el7 rpcbind.x86_64 0:0.2.0-48.el7 tcp_wrappers.x86_64 0:7.6-77.el7
Complete!
[root@lc-nfsserver ~]#
|
Step 2. Start Services:
Once the packages are installed start the services and enable to start on boot
up:
[root@lc-nfsserver ~]#
systemctl enable nfs-server rpcbind
Created symlink from
/etc/systemd/system/multi-user.target.wants/nfs-server.service to
/usr/lib/systemd/system/nfs-server.service.
[root@lc-nfsserver ~]#
systemctl start
nfs-server rpcbind
[root@lc-nfsserver ~]#
|
Step 3. Configure NFS Share
Directory: Create a new directory and allow full access to
the NFS clients for NFS share configuration:
[root@lc-nfsserver ~]#
mkdir /nfsshare
[root@lc-nfsserver ~]#
chmod 777 /nfsshare/
[root@lc-nfsserver ~]#
ls -ld /nfsshare/
drwxrwxrwx. 2 root
root 6 Oct 21 05:19 /nfsshare/
[root@lc-nfsserver ~]#
|
Modify
/etc/export configuration and put the following parameters. Change the address
192.168.43.24 according to environment and access restrictions:
[root@lc-nfsserver ~]#
vi /etc/exports
/nfsshare 192.168.43.24(rw,sync,no_root_squash)
|
Save
the file and export the shared directory for clients using following command:
[root@lc-nfsserver ~]#
exportfs -r
[root@lc-nfsserver ~]#
|
Step 4. Firewall Configuration:
Configure firewall to allow clients to access NFS Share:
[root@lc-nfsserver ~]#
firewall-cmd --permanent --add-service={mountd,nfs,rpc-bind}
success
[root@lc-nfsserver ~]#
firewall-cmd --reload
success
[root@lc-nfsserver ~]#
|
NFS client Configuration: Follow
the article How to Mount NFS Share on CentOS 7 Client.
No comments:
Post a Comment