What is NFS Server?
NFS (Network File System) is a protocol used for sharing files and directories over a network. It allows multiple systems to access the same files as if they were on the local system. An NFS server is a system running the NFS service, which exports (shares) one or more directories to clients over the network. To set up an NFS server on Linux, you need to install the NFS server package, configure the shared directories in the
/etc/exports file, and start the NFS service. Clients can then use the
mount command to access the shared directories. NFS is a versatile and widely used protocol, it’s important to apply appropriate permissions and security settings in production environments.
How to Configure NFS Server on Fedora Linux
To configure an NFS (Network File System) server on Fedora Linux, you will need to complete the following steps:
- Install the NFS server package. You can do this by running the following command:
sudo dnf install nfs-utils
- Start and enable the NFS service. You can do this by running the following commands:
sudo systemctl start nfs-server sudo systemctl enable nfs-server
- Create a directory that will be shared over NFS. This can be any directory on your system. For example, you can create a directory called
/nfs-shareand make it owned by the
nfsnobodyuser and group:
sudo mkdir /nfs-share sudo chown nfsnobody:nfsnobody /nfs-share
- Edit the
/etc/exportsfile to configure the shared directory. This file controls which directories are exported over NFS and what permissions are given to clients. To share the
/nfs-sharedirectory with read and write access for all clients, you can add the following line to the
- Reload the NFS server configuration. You can do this by running the following command:
sudo exportfs -a
- Firewall configuration:
sudo firewall-cmd --permanent --add-service=nfs sudo firewall-cmd --reload
- You can test your NFS server by mounting the shared directory on another system. For example, you can use the
mountcommand on a client system to mount the
/nfs-sharedirectory from the NFS server:
mount <server-IP>:/nfs-share <mount-point>
- Verify the exported file systems by using the following command:
showmount -e <server-IP>
Please note that this is a basic configuration and you might need to customize it according to your needs.
It’s also important to know that you should use appropriate permissions and security settings in production environments and that this configuration is only recommended for testing and learning purposes.