We're here to assist with any of your needs, don't hestitate to reach out.
NFS (Network File System) is a distributed file system protocol that allows you to share files and directories with other Linux/Unix clients over a network. It enables multiple computers to access the same files and directories concurrently. NFS is commonly used in environments where centralized storage is required and file sharing between multiple systems is necessary.
Here are the steps to install NFS on CentOS 7:
Before installing any new software, it's good practice to update the system packages to their latest versions by running the following command:
sudo yum update -y
To install NFS server, run the following command:
sudo yum install nfs-utils -y
Next, enable and start the required NFS services by running the following commands:
sudo systemctl enable nfs-server rpcbind sudo systemctl start nfs-server rpcbind
Now, we need to configure the NFS exports, which specify the directories that will be shared with other systems. Edit the NFS exports file using your preferred text editor:
sudo vi /etc/exports
Add the directories that you want to share in the following format:
/path/to/directory client_ip(rw,sync)
Replace /path/to/directory
with the actual path of the directory you want to share, and client_ip
with the IP address or subnet of the client system that will be allowed to access the shared directory.
For example, to share the directory /shared
with a client at IP address 192.168.1.100
, add the following line:
/shared 192.168.1.100(rw,sync)
Save and close the file.
After configuring the NFS exports, you need to export them by running the following command:
sudo exportfs -a
If you have the firewall enabled, allow NFS services through the firewall by running the following commands:
sudo firewall-cmd --permanent --zone=public --add-service=nfs sudo firewall-cmd --reload
Now, you can test the NFS mount by mounting the shared directory on the client system. On the client system, run the following command:
sudo mount server_ip:/shared /mnt
Replace server_ip
with the IP address of the NFS server.
If the mount is successful, you should be able to access the shared directory on the client system.
Congratulations! You have successfully installed and configured NFS on CentOS 7. You can now share files and directories between your systems using NFS.
What our customers say about us
Create your free account today.