Linux NFS Server Setup and Configuration With Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-nfs-server-setup-configuration-examples/
PINTEREST
PINTEREST
INSTAGRAM

Network file System is is simple way to share files and folders over network. NFS is developed by Sun Micro-systems in 1980. NFS is very popular in Linux and Unix world. NFS is alternative for SMB which is Windows ecosystem file sharing protocol. We will look how to install NFS server, share files and mount shares in this tutorial with some extra configurations.

Install NFS

Installing NFS can be done for Ubuntu, Debian, Kali, Mi

Ubuntu, Debian, Kali, Mint:

Install NFS

Install NFS

Fedora, CentOS, RedHat:

Install NFS

Install NFS

Man

Man page for NFS daemon or simple server can be get like below.

Man

Man

Configuration Files

NFS server works as daemon as expected. Daemon configuration file is by default in /etc/default/nfs-kernel-server for Ubuntu based systems

Ubuntu, Debian, Kali, Mint:

Fedora, CentOS, RedHat:

Services

NFS server have more then one service to share file and folders.

Export File

Shares are generally defined in different configuration files than daemon configuration files. NFS shares are called exports and stored into /etc/exports . Below we can see default export file.

Export files

As we see in this file some examples shares are defined in comments which have no effect.

Create Share

As stated previously to create share an entry should be created in export file. We will create a simple entry which do not have advanced attributes. Say our directory we want to share is located at /share .

LEARN MORE  How To Make Samba Server Secure?

Put following line to the /etc/exports

Reload NFS Server

We have change the configuration of NFS server and created a new share to enable the new configuration we  should reload the server.

Ubuntu, Debian, Kali, Mint:

Reload NFS Server

Reload NFS Server

Fedora,CentOS, RedHat:

Reload NFS Server

Reload NFS Server

List Shares

NFS has the ability to list shares. This feature is similar to the SMB. We will run list command from our client named ubu2 . While trying to list share there can be an error like clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host) which simply means a network access error. Generally firewalls will prevent access to the NFS service to get share list. Create appropriate rules to access these services.

List NFS Shares

List NFS Shares

Mount NFS Share

NFS shares can be mounted to the local system with regular mount command and NFS related parameters. To mount NFS share NFS file system libraries must be installed which is provided by NFS packages we have previously installed.

Mount NFS Share

Mount NFS Share

  • While mounting shares NFS type provided with -t nfs
  • And remote NFS share specified 192.168.122.179:/share
  • Local mount path is working directory mnt

Unmount NFS

Unmounting is same as regular disk based file systems. This will unmount NFS file system.

Unmount NFS

Unmount NFS

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-nfs-server-setup-configuration-examples/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)