环境

  • Red Hat Enterprise Linux 7

问题

  • How do I configure NFS in RHEL 7?
  • How do I enable the NFS service in RHEL 7?

决议

  1. Install NFS packages on the system using the following command:
    Raw
    # yum install nfs-utils rpcbind
  2. Enable the services at boot time:
    Raw
    # systemctl enable nfs-server # systemctl enable rpcbind # systemctl enable nfs-lock <-- In RHEL7.1 (nfs-utils-1.3.0-8.el7) this does not work (No such file or directory). it does not need to be enabled since rpc-statd.service is static. # systemctl enable nfs-idmap <-- In RHEL7.1 (nfs-utils-1.3.0-8.el7) this does not work (No such file or directory). it does not need to be enabled since nfs-idmapd.service is static.
  3. Start the NFS services:
    Raw
    # systemctl start rpcbind # systemctl start nfs-server # systemctl start nfs-lock # systemctl start nfs-idmap
  4. Check the status of NFS service:
    Raw
    # systemctl status nfs
  5. Create a shared directory:
    Raw
    # mkdir /test
  6. Export the directory:
    Raw
    # vi /etc/exports /test *(rw)
  7. Exporting the share:
    Raw
    # exportfs -r
  8. Restart the NFS service:
    Raw
    # systemctl restart nfs-server