Install And Configure NFS Server On RHEL/CentOS 8 - Bobcares
Maybe your like
Install and Configure NFS Server on RHEL 8/CentOS 8 with few quick and easy steps.
At Bobcares, we often get requests from our customers to install NFS in their server as a part of Server Management Services.
Today let’s see how our Support Techs implement this for our customers in an easy way.
How to Install and Configure NFS Server on RHEL 8/CentOS 8?
Network File System(NFS) allows client systems to access files that are stored on a remote shared server over a network and lets to make use of those file systems.
NFS is a client-and-server file system(FS). We can share files with NFS easily between multiple systems on the same network.
Here we will setup NFSv4.2 on our RHEL/CentOS system.

Steps to Install and Configure NFS Server on RHEL
We will see the steps that our Support Techs follow to install and configure NFS.
1. Updating server and setting hostname
We can use the following commands:
$ sudo yum -y update $ sudo hostnamectl set-hostname server.example.com --staticM</code?2. Installing NFS Server on CentOS 8/RHEL 8
First, we can install the NFS server packages on RHEL/CentOS 8 system.
$ sudo yum -y install nfs-utilsThen start and enable nfs-server service.
$ sudo systemctl enable --now nfs-server rpcbind3. Exporting NFS Shares on RHEL 8/CentOS 8
For configuring exports on an NFS server there are two ways:
1. Manually editing the /etc/exports configuration file 2. Using the exportfs utility via command line
Syntax rules for /etc/exports configuration file are given below:
1. Blank lines are ignored. 2. Start a line with the hash (#) to add a comment. 3. With backslash (\) wee can wrap long lines. 4. Each exported file system should be on its own individual line. 5. Use space character if any lists of authorized hosts have to be mentioned after an exported file system 6. Options for each of the hosts should be placed in parentheses directly after the host identifier, without any spaces separating the host and the first parenthesis.The steps to follow are given below:
1. We will take a secondary disk with a capacity of 20 GB. And partition this disk to create a file system on it to use as an NFS share.
$ lsblk | grep sdb sdb 8:16 0 20G 0 disk2. Give the following commands to create partition and file system
$ sudo parted -s -a optimal -- /dev/sdb mklabel gpt $ sudo parted -s -a optimal -- /dev/sdb mkpart primary 0% 100% $ sudo parted -s -- /dev/sdb align-check optimal 1 $ sudo mkfs.xfs /dev/sdb13. After that, we will mount this to /data directory.
$ sudo mkdir /data $ echo "/dev/sdb1 /data xfs defaults 0 0" | sudo tee -a /etc/fstab $ sudo mount -aWe can check if it’s mounted properly with the following command.
$ df -hT | grep /data /dev/sdb1 xfs 20G 176M 20G 1% /dataNext, we will create a directory on /data/nfshare
$ sudo mkdir /data/nfshareNow we need to modify /etc/exports to configure NFS share.
The structure is:
export host(options)Next we will use the exportfs utility to selectively export directories without restarting the NFS service.
$ sudo exportfs -ravFinally, we have to allow NFS service in firewalld.
$ sudo firewall-cmd --add-service=nfs --permanent $ sudo firewall-cmd --add-service={nfs3,mountd,rpc-bind} --permanent $ sudo firewall-cmd --reload4. Mounting NFS Shares on Client Machines
We can mount NFS shares on a client system after the above steps. The client could be a remote system, a Virtual Machine on the same server, or on the same server itself.
[Need assistance? We are here for you!]
Conclusion
To conclude we saw how to Install and Configure NFS Server on RHEL along with the steps that our Support Engineers use.
Related posts:
- Failed to restart network.service – How to fix
- NFS vs SMB – Which one to choose?
- NFS vs CIFS – which one to choose?
- Troubleshooting “Unable to Mount NFS Share in RHEL 7” Issue
Tag » How To Restart Nfs Service In Rhel 8
-
8.5. Starting And Stopping The NFS Server Red Hat Enterprise Linux 7
-
Chapter 5. Exporting NFS Shares Red Hat Enterprise Linux 8
-
Install And Configure NFS Server On RHEL 8 / CentOS 8
-
How To Setup NFS Server On CentOS 8 / RHEL 8 - LinuxTechi
-
17.1 Ensuring NFS Services Are Running On RHEL 8 | Red Hat ...
-
How To Set Up NFS Server And Client On CentOS 8 - Tecmint
-
Redhat / RHEL / CentOS Linux: Start / Stop / Restart NFS Service ...
-
9.2. Starting And Stopping NFS
-
How To Restart NFS Service In RHEL 7 - Bobcares
-
Create An NFS Server On Oracle Linux
-
Steps To Configure NFS Server & Client In RHEL/CentOS 7/8
-
CentOS / RHEL 7 : Configuring An NFS Server And NFS Client
-
Using NFS To Share RHEL 8 Files With Remote Systems - Techotopia
-
Learn How To Set Up NFS Server Of CentOS 8 And RHEL 8 - LinuxAPT