Menü Schließen

CentOS7 – NFS V4 Server und Client Installation

CentOS Logo

Kurze Anleitung zur Installation von NFS Version 4 unter CentOS 7.

System

CentOS 7.1 in der Minimalinstallation

System aktualisieren

# yum check-updates
# yum update

NFS Server installieren

# yum -y install rpcbind nfs-utils nfs4-acl-tools libnfsidmap

rpcbind – setzt Ports dynamisch für RPC Dienste

NFS Verzeichnis erstellen

# mkdir -p /share

NFS ISO Export read write erlauben

# mcedit /etc/exports
/share *(rw) #all clients or ->
/share 192.168.0.0(rw) #only from 0.x net

NFS Berechtigung vergeben

# chmod -R 777 /export

NFS konfigurieren

NFSV4.1 Ports für moutd, statd und lockd werden nicht benötigt. Da sich die Ports nicht dynamisch ändern sollen, werden sie nun fest konfiguriert.

# mcedit /etc/sysconfig/nfs

LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
RPCNFSDCOUNT=16
RPCMOUNTDOPTS=“-p 892″  #use always port 982
RPCRQUOTADOPTS=“-p 875″ #muss nicht
STATDARG=“-p 662 -o 2020″
GSS_USE_PROXY=“no“

NFS Firewall konfigurieren

NFS Service zur Firewall hinzufügen
# firewall-cmd –permanent –add-service=nfs
oder
# firewall-cmd –permanent –zone=public –add-service=nfs
# firewall-cmd –permanent –zone=public –add-service=mountd
# firewall-cmd –permanent –zone=public –add-service=rpc-bind
success

Firewall neu laden
# firewall-cmd –reload
success

NFS Dienste zur Bootzeit

# systemctl enable rpcbind
# systemctl enable nfs-server
# systemctl enable nfs-lock #no such file or directory bei mir
# systemctl enable nfs-idmapd
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit’s
.wants/ or .requires/ directory.
2) A unit’s purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, …)

NFS Dienste starten

# systemctl start rpcbind
# systemctl start nfs-server
# systemctl start nfs-lock
# systemctl start nfs-idmap
# systemctl start rpc-statd

NFS Installation kontrollieren

NFS Protokolle, Daemons und Ports anzeigen

# rpcinfo -p
program vers proto   port  service
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100227    3   tcp   2049  nfs_acl
100003    3   udp   2049  nfs
100003    4   udp   2049  nfs
100227    3   udp   2049  nfs_acl

NFS Shares lokal prüfen

# showmount -e localhost / # showmount -e hostname
Export list for nfsserver.localdomain:
/shares 192.168.0.0/24

NFS Shares remote prüfen

# showmount -e nfsserver
Export list for nfsserver.localdomain:
/shares 192.168.0.0/24

NFS Client Share mounten

# mount -t nfs nfsserver:/export /mnt/nfs

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert