Red Hat supplies precompiled NFS modules for the Linux kernel, which the kernel loads when you mount a NFS filesystem.
Red Hat Linux starts portmap automatically at boot.
If you configure your network information, then Red Hat Linux automatically starts the NFS server daemons rpc.mountd and rpc.nfsd at boot.
Because Red Hat Linux starts the necessary servers, you only need to configure the exported filesystems. The /etc/exports file describes exported filesystems, including access permissions and read/write privileges. To configure the exported filesystems, open /etc/exports in your favorite editor.
Steps to configure Red Hat NFS Server
To configure a Red Hat NFS server, you can follow these general steps:
Install the NFS server packages using the package manager of your choice. You may need to install multiple packages depending on your specific needs.
Configure the NFS server by editing the "/etc/exports" file. This file specifies the directories and files that will be exported by the NFS server, as well as the access permissions and options for each exported item.
Start the NFS server service using the following command:
systemctl start nfs-server
You can also enable the service to start automatically at boot time using the following command:
systemctl enable nfs-server
Configure the firewall to allow NFS traffic. You may need to add firewall rules to allow NFS traffic through the firewall, depending on your specific firewall configuration.
Test the NFS server by mounting the exported filesystems on a client machine. You can use the "showmount" command to display the list of exported filesystems, and the "mount" command to mount the filesystems on a client machine.
Configure additional NFS server options as needed. You may need to configure other NFS server options such as security settings, performance tuning parameters, and logging settings to meet your specific needs.
These are the general steps to configure a Red Hat NFS server. The exact steps may vary depending on your specific version of Red Hat Linux and your specific configuration needs. It's important to consult the NFS documentation and seek assistance from qualified support resources as needed to ensure that your NFS server is configured correctly and securely.
The /etc/exports file
Regardless of how you edit /etc/exports, you should be familiar with its layout.
One day, you might want to look through the file to make sure it's exporting only those filesystems you want publicly available.
The following MouseOver illustrates the general format of /etc/exports.
The exportfs command is the general tool for working with exported filesystems. You will most often use exportfs in one of four ways:
To notify the NFS system you made changes to /etc/exports. Once you have changed your exported filesystems, run exportfs -r to incorporate them.
To unexport (disconnect an exported filesystem) all filesystems listed in /etc/exports. You might want to unexport the filesystems if you discover a security breach or are running diagnostics. To do so, run exportfs -ua.
To export all filesystems, which you might need after you've unexported them all. Use exportfs -a to export all filesystems.
To show all exported filesystems. Use exportfs -v to list filesystems that are currently exported.
Unexport: The opposite of exporting. A jargon term meaning to make a previously exported NFS filesystem unavailable.
In the next lesson, you will learn about NFS security issues.