NFS

From Bashlinux
Jump to: navigation, search

Setup

How to setup an NFS server on CentOS 6

  • Install packages
# yum install nfs-utils nfs-utils-lib
  • Enable services
# chkconfig rpcbind on
# chkconfig nfs on
  • Add your entries to /etc/exports
/path/to/share	10.20.30.0/24(rw,no_root_squash,sync)
  • Export new added share
# exportfs -a
  • Set the domain in both ends server & client at /etc/idmapd.conf
Domain = localhost
  • Start services
# service rpcbind start
# service nfs start
  • Clean nfs idmap
# nfsidmap -c

How to setup an NFS server on CentOS 7

  • Install the packages
# yum install nfs-utils
  • Enable services
# systemctl enable rpcbind
# systemctl enable nfs-server
# systemctl enable nfs-lock
# systemctl enable nfs-idmap
  • Add your entries to /etc/exports
/path/to/share	10.20.30.0/24(rw,sync,no_root_squash,no_all_squash)
  • Export new added share
# exportfs -a
  • Set the domain in both ends server/client at /etc/idmapd.conf
Domain = localhost
  • Start services
# systemctl start rpcbind
# systemctl start nfs-server
# systemctl start nfs-lock
# systemctl start nfs-idmap
  • Open the proper ports in the firewall
# firewall-cmd --permanent --add-port=111/tcp
# firewall-cmd --permanent --add-port=20048/tcp
# firewall-cmd --permanent --add-port=2049/tcp
# firewall-cmd --permanent --add-port=875/tcp