Support >
  About cybersecurity >
  NFS server and client installation manual for the RHEL system
NFS server and client installation manual for the RHEL system
Time : 2024-12-23 13:45:09
Edit : Jtti

Linux has file sharing protocols for sharing storage and files over a network. The commonly used protocols are Samba and NFS. Samba is a popular open source application suite that uses a client-server architecture and provides cross-platform compatibility. Files can be shared seamlessly between Linux, Windows, and macOS operating systems. File sharing on Linux systems can be accessed from different platforms, facilitating collaboration. Another type of NFS is short for Network File sharing, which allows users to share directories and files with multiple remote client users through me. The following describes the installation of the NFS server and client on the RHEL system.

NFS version released four main, less/NFSv3 / NFSv4.0 / NFSv4.1. NFSv4 has significant changes and improvements over earlier versions, especially in the areas of state management and security. These versions are still widely used, especially in sharing scenarios that require high performance and high availability.

The NFS server (NFS-server) allows clients to access nfs shared files, while the rpcbind service takes care of mapping RPC programs to common addresses. The nfs-idmap service takes care of the conversion between user and group ids and names. The portmap service maps RPC program numbers to IP port numbers and is a key component of RPC communication. The nfslock service ensures that the necessary RPC process is started to maintain the stability of the NFS service when the NFS server crashes. These components work together to ensure proper running of NFS services and efficient sharing of data.

Before installing the NFS server, ensure that the server has a static IP address and a static host name:

sudo yum -y update

sudo hostnamectl set-hostname server.example.com --static

On RHEL/CentOS 8, run the following command to install the NFS server:

sudo yum -y install nfs-utils

After the installation is complete, start NFS services and set them to start automatically when the system starts: :

sudo systemctl enable --now nfs-server rpcbind

NFS can be configured to be shared. To share a directory, you can add the following line to /etc/exports:

/data/nfs *(rw,sync,no_subtree_check)

Then run exportfs-arv to apply the changes.

Install the NFs-utils package on the client system to access the NFS server share:

sudo yum -y install nfs-utils

Create a mount point and mount NFS. For example, if the shared directory on the server is /data/nfs and the mount point on the client is /mnt/nfs:

sudo mkdir -p /mnt/nfs

sudo mount -t nfs server.example.com:/data/nfs /mnt/nfs

To automatically complete NFS sharing during system startup, add the following lines to the /etc/fstab file:

server.example.com:/data/nfs /mnt/nfs nfs defaults 0 0

Deleting an NFS mount:

$ umount ~/nfs_backup

Important NFS commands:

showmount -e - Displays the available shares on the local computer

showmount -e ip-address - Lists the shares available on the remote server

showmount -d - Lists all subdirectories

exportfs -v - Displays a list of shared files and options on the server

exportfs -a - Export all shares listed in /etc/exports, or specify a name

exportfs -u - Unexports all shares listed in /etc/exports, or by name

exportfs -r - Refresh server list after modifying /etc/exports

JTTI-Defl
JTTI-COCO
JTTI-Selina
JTTI-Ellis
JTTI-Eom