Setup NFS Server On openSUSE 42.1

About Network File System (NFS)

NFS, Network File System, is used for share files between linux/unix to unix/linux systems. With NFS, users can access files on remote systems as if they were stored locally.

NFS has many practical uses. Some of the more common uses include:

Data that would otherwise be duplicated on each client can be kept in a single location and accessed by clients on the network.

Several clients may need access to the /usr/ports/distfiles directory. Sharing that directory allows for quick access to the source files without having to download them to each client.

On large networks, it is often more convenient to configure a central NFS server on which all user home directories are stored. Users can log into a client anywhere on the network and have access to their home directories.

Administration of NFS exports is simplified. For example, there is only one file system where security or backup policies must be set.

Removable media storage devices can be used by other machines on the network. This reduces the number of devices throughout the network and provides a centralized location to manage their security. It is often more convenient to install software on multiple machines from a centralized installation media.

NFS consists of a server and one or more clients. The client remotely accesses the data that is stored on the server machine. In order for this to function properly, a few processes have to be configured and running.

These daemons must be running on the server:

nfsd – The NFS daemon which services requests from NFS clients.

mountd – The NFS mount daemon which carries out requests received from nfsd.

rpcbind – This daemon allows NFS clients to discover which port the NFS server is using.

Setup NFS Server On openSUSE 42.1

This tutorial will describe how to setup NFS server on openSUSE 42.1. The steps given in this tutorial should work on older openSUSE versions such as 13.2, 13.1 etc.

Scenario

For the purpose of this guide, I will be using two systems. The NFS server is openSUSE 42.1 and NFS client is Ubuntu 14.04 LTS.

Here is the ip address details of my server and client systems.

NFS Server IP Address : 192.168.1.102/24

NFS Client IP Address : 192.168.1.100/24

Install NFS in Server system

sudo zypper in nfs-kernel-server

Start NFS service

Enable and Start rpcbind and nfs services.

sudo systemctl enable rpcbind.service

sudo systemctl start rpcbind.service

sudo systemctl enable nfsserver.service

sudo systemctl start nfsserver.service

Install NFS in Client System

Enter the following command in client to install nfs-client package.

On Debian/Ubuntu:

sudo apt-get install nfs-common

On RHEL/CentOS/:

sudo yum install nfs-utils nfs-utils-lib

On SUSE/openSUSE:

sudo zypper in nfs-client

Create NFS shares in server

Create a shared directory named ‘/var/unixmen_share’ in server and let the client users to read and write files in that directory.

sudo mkdir /var/unixmen_share

sudo chmod 755 /var/unixmen_share/

Export shared directory on NFS Server

Open /etc/exports file,

sudo nano /etc/exports

Add the nfs share in it.

# See the exports(5) manpage for a description of the syntax of this file.
# This file contains a list of all directories that are to be exported to
# other computers via NFS (Network File System).
# This file used by rpc.nfsd and rpc.mountd. See their manpages for details
# on how make changes in this file effective.
/var/unixmen_share/ 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)

Save and close the file.

where,

/var/unixmen_share – shared directory

192.168.1.0/24 – IP address range of clients

rw – Read/Write permission to shared folder

sync – Synchronize shared directory

no_root_squash – Enable root privilege

no_all_squash – Enable user’s authority

Please be mindful that if you modify the /etc/exports file in future, you should run the following command to enable the changes.

sudo exportfs -a

Now restart rpcbind and nfs services.

sudo systemctl restart rpcbind.service

sudo systemctl restart nfsserver.service

Mount NFS shares in client

Go to your client system and Create a mount point to mount the share directory ‘var/unixmen_local’ which we created earlier.

To allow NFS server to access from the outbound, goto YAST control center -> Security and Users -> Firewall. Navigate to Allowed Services tab. Select NFS Secure Service from Service to Allow drop down box and click add. Finally click Next to allow the nfs service through suse firewall.

Then mount the nfs share in the client system using the following command:

sudo mount -t nfs 192.168.1.102:/var/unixmen_share/ /var/nfs_share/

Now the NFS share will be mounted on client systems without any issues.

Verify NFS

Verify the server NFS share is mounted in client using following methods.

POPULAR CATEGORY

Unixmen provide Linux Howtos, Tutorials, Tips & Tricks ,Opensource News. It cover most popular distros like Ubuntu, LinuxMint, Fedora, Centos. It is your Gate to the the world of Linux/Unix and Opensource in General.