Table of Contents

NFS Server - Red Hat 7 / 8

A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.

Server Konfiguration

Installation eines NFS Servers, um eigene Dateien via Netzwerkshare zu verwalten.

  1. Benötigte Packete Installieren
    # yum -y install nfs-utils
  2. Festlegen des korrekten Domain-namens:
    # vim /etc/idmapd.conf

    [General]
    #Verbosity = 0
    # The following should be set to the local NFSv4 domain name
    # The default is the host's DNS domain name.
    Domain = blackgate.org
    ..

  3. Definition eines neuen NFS Shares:
    # vim /etc/exports

    /volume1/server-backups 192.168.1.0/24(rw,sync)
    In this example all Clients in 192.168.1.0/24 can mount /volume1/server-backups read/write and all transfers to disk are committed to the disk before the write request by the client is completed.

  4. Setzen der korrekten Firewall Rules:
    # firewall-cmd --add-service=nfs --permanent
    # firewall-cmd --add-service=rpcbind --permanent
    # firewall-cmd --add-service=mountd --permanent
    
    # firewall-cmd --reload 
  5. Zum Schluss wird der Services gestartet und enabled:
    # systemctl enable rpcbind nfs-server --now

Client Konfiguration

  1. Benötigte Packete Installieren
    # yum -y install nfs-utils
  2. Benötigte Services starten und enablen:
    # systemctl enable rpcbind --now
  3. Mounten des Shares: server-backups auf das Verzeichnis: /mnt/server-backup
    # mount -t nfs -o rw,hard 192.168.1.21:/volume1/server-backups /mnt/server-backup

Für einen Eintrag in die /etc/fstab lautet die Syntax wie folgt:

10.0.0.21:/volume1/media /mnt/blackserv nfs rw,hard,intr 0 0