For more information about all the available options, type man exports in your terminal. The last line should be self-explanatory. The sync option tells NFS to write changes to the disk before replying. It exports the /srv/nfs4/backups directory and allows only read access to the whole 192.168.33.0/24 range, and both read and write access to 192.168.33.3.
DOWNLOAD NFS 2 SE SETUP FILE HOW TO
The second line shows how to specify multiple export rules for one file system. To make the bind mounts permanent, add the following entries to the /etc/fstab file: sudo nano /etc/fstab
Mount the actual directories: sudo mount -bind /opt/backups /srv/nfs4/backups sudo mount -bind /var/www /srv/nfs4/www The /var/www/ is owned by the user and group apache and /opt/backups is owned by root.Ĭreate the export filesystem using the mkdirĬommand: sudo mkdir -p /srv/nfs4/ To better explain how the NFS mounts can be configured, we’re going to share two directories ( /var/www and /opt/backups) with different configuration settings. In this example, we will use the /srv/nfs4 directory as NFS root. When configuring an NFSv4 server, it is a good practice is to use a global NFS root directory and bind mount the actual directories to the share mount point. The default settings are sufficient for our tutorial. NFS server configuration options are set in /etc/nf and /etc/nfs.conf files. To verify it run the following catĬommand: sudo cat /proc/fs/nfsd/versions -2 +3 +4 +4.1 +4.2 NFSv2 is pretty old now, and there is no reason to enable it. Once the installation is complete, enable and start the NFS service by typing: sudo systemctl enable -now nfs-serverīy default, on CentOS 8 NFS versions 3 and 4.x are enabled, version 2 is disabled.
DOWNLOAD NFS 2 SE SETUP FILE INSTALL
To install it run the following command: sudo dnf install nfs-utils The “nfs-utils” package provides the NFS utilities and daemons for the NFS server. This section explains how to install the necessary packages, create and export the NFS directories, and configure the firewall. The machines in this example have the following IPs: If your hosting provider doesn’t offer private IP addresses, you can use the public IP addresses and configure the server firewall to allow traffic on port 2049 only from trusted sources. The server and the clients should be able to communicate with each other over a private network. We’re assuming that you have a server running CentOS 8 on which we will set up the NFS server and other machines that will act as NFS clients. We’ll also show you how to mount an NFS file system on the client. In this tutorial, you’ll go through the steps necessary to set up an NFSv4 Server on CentOS 8. Access to the server is restricted by the clients' IP addresses or hostnames. NFS protocol is not encrypted by default, and unlike Samba, it does not provide user authentication. With NFS, you can mount remote directories on your system and work with the files on the remote machine as if they were local files. Network File System (NFS) is a distributed file system protocol that allows you to share remote directories over a network.