Tutorial: How to set up an NFS Server on CentOS
You can convert a plain CentOS machine into an NFS server by installing the NFS Linux packages and configuring access to the shared directories. Here's a simple step-by-step guide to help you get this set up.
Step 1 - Download and Install the Required NFS Software
Start by downloading and installing the required NFS packages.
Start the appropriate NFS services.
Step 2 - Export Appropriate Shared Directories
Next step is to export appropriate directories on your NFS server so that they are accessible via NFS clients. You do this by adding the appropriate directory to /etc/exports file, which specifies both the directory to be shared and the details of how it is shared.
Edit the /etc/exports file:
Add the following line to the file:
where /foo is the directory you are trying to export.
- rw: This option allows the client server to both read and write within the shared directory
- sync: Sync confirms requests to the shared directory only once the changes have been committed.
- no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
- no_root_squash: This phrase allows root to connect to the designated directory
- insecure: The default NFS setting is "secure" which requires that requests originate on an Internet port less than IPPORT_RESERVED (1024). To turn this setting off, specify insecure.
Add entries to the /etc/exports file for each directory you wish to export.
Once that's done, export the directories:
October 14, 2015