Install and Configure NFS Server on Oracle Linux 8

In this guide, we are looking at how to install nfs server on Oracle Linux 8 and configure it. NFS is short for Network File System. It is a type of a distributed file system mechanism which enables storing and retrieving of data from multiple disks and directories on a shared network. Users are able to access remote files and directories and just the way they access locally.

It uses Remote Procedure Call (RPC) to route requests between servers and clients, sharing file system over a network. It works in all IP-based systems, using TCP and UDP protocols to access and deliver data. The act of making file systems available to clients is called exporting.

Install Required Packages for NFS Server

We need to install nfs-utils which provide a daemon for kernel nfs server. Run the below command to install

sudo dnf install nfs-utils

Start and Enable nfs service

Once the installation complete, start and enable nfs service using the commands below

sudo systemctl enable nfs-server.service
sudo systemctl start nfs-server.service
sudo systemctl status nfs-server.service

Create and Export NFS share

Now we need to create file systems that will be exported/shared with nfs clients. Nfs shares are defined in /etc/exports as below

sudo nano /etc/exports
/share/path {client-ip}(rw,sync,no_wdelay,insecure_locks,no_root_squash)

Now export the created share with the command below

sudo exportfs -arv

You can confirm the export list with the below command

sudo exportfs -s

Configure Firewall and SElinux

We need to allow nfs services through the firewall as below

sudo firewall-cmd –permanent –zone=public –add-service=nfs
sudo firewall-cmd –permanent –zone=public –add-service=rpc-bind
sudo firewall-cmd –permanent –zone=public –add-service=mountd
sudo firewall-cmd –reload
sudo firewall-cmd –list-all

If you have SElinux active, you need to run the below command

sudo setsebool -P nfs_export_all_rw 1

Configure NFS Client On Oracle Linux 8

To configure nfs client on Oracle Linux 8, install the required packages

sudo dnf install nfs-utils nfs4-acl-tools

Once installed, show mount information for the nfs server with the below command

sudo showmount -e {server-ip}

Now we need to create a directory for mounting the exported file share

sudo mkdir -p /mount/path
sudo mount -t nfs {server-ip}:/share/path /mount/path

For persistent mount even after reboot, update fstab file.

sudo nano /etc/fstab
server-ip}:/share/path /mount/path nfs defaults 0 0

That’s it. You have successfully installed and configured NFS server and Client on Oracle Linux 8.

Leave a Reply

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