preloader
  • Home
  • Linux NFS Sever in 5 Minutes

Quick deploy NFS Server for General Use

blog-thumb

A NFS server can be used as a file server and shared storage for general purposes.

All you need is:

  • – A Linux server running CentOS 8+

  • – 4GB RAM

  • – 20Gb hard disk.

If you need more space for data storage, use larger disks.


NFS Server

To quickly install an NFS server on Linux, just run the following commands.

Software:

dnf -y install mc nfs4-acl-tools nfs-utils sssd-nfs-idmap libnfsidmap

Enable NFS Service:

systemctl enable --now nfs-server.service

Check RPC:

rpcinfo -p

Create the shared directories:

mkdir -p {/registry,/shares} && \
chown -R nobody: {/registry,/shares} && \
chmod 775 {/registry,/shares}

Export the shared directories:

tee /etc/exports <<EOF
/registry *(rw,sync,no_all_squash,root_squash)
/shares *(rw,sync,no_all_squash,root_squash)
EOF
exportfs -arv && exportfs -s

Firewall and SELinux

Firewall and SELinux are beyond the scope of this article. So, disable them to move on more quickly.


I recommend that in production environments SELinux is always in Enforcing mode, and that the local Firewall is enabled.


Disable SELinux:

sed -i s/=enforcing/=disabled/g /etc/selinux/config

Disable local Firewall:

systemctl disable firewalld.service

Reboot and you’re done.

reboot

The nfs-server service will start automatically during boot, and will be ready for use it.


Other NFS solutions

If you’re adventurous and like to try out new things, I recommend NFS Ganesha, which is a solution that runs in userspace, and delivers good performance.


Did you like the content? Check out these other interesting articles! 🔥



Could you help?

Please support this content by clicking on one of our advertisers’ banners. ❤️

comments powered by Disqus