Linux Lab Project: Building a Simple Linux NFS Server



  • A very common task with Linux, or any UNIX server, is building an NFS File Server (or NAS, as many people would call it.) NFS is the most common network file protocol in the UNIX world and is cross-platform, easy to use and very efficient.

    For this project, to keep things simple, I'm just going to build a basic CentOS 7 server with 100GB of storage on XFS on LVM, which gives me a highly robust, high performance, very scalable filesystem with snapshot and other features.

    This is purely a lab system to be blown away later, so I can share all details.

    NFS Fileserver on Scale HC3

    Just a single vCPU, 2GB RAM and the system is named "SAM-UserNAS". Very simple but this will provide us with a solid file server for our needs.

    Our disk setup is pretty simple, during installation I make a single 84GB logical volume to be mounted on /data that will house our file server data.

    Data Volume on CentOS 7 Install

    We can start by prepping the packages on the server:

    yum -y update
    yum -y install nfs-utils
    

    Then we can configure the NFS services:

    systemctl enable rpcbind
    systemctl enable nfs-server
    systemctl start rpcbind
    

    Now we will set up the file space:

    mkdir /data/users
    chmod 777 /data/users
    

    We need to, of course, open the system firewall to allow NFS traffic to pass to the server.

    firewall-cmd --permanent --zone=public --add-service=nfs
    firewall-cmd --reload
    

    The configuration of our NFS file server is help in the /etc/exports file. We can edit this to include the directory that we want to share:

    vi /etc/exports
    

    And we will add this line. The IP range in question is the internal LAN for this example:

    /data/users    10.100.42.0/24(rw,sync,no_root_squash,no_all_squash)
    

    After we set up the share we can start the service now that it has something to do.

    systemctl start nfs-server
    

    And there we go, we have an NFS share already available from our new NFS file server.



  • Very nice topic.

    Out of curiosity, what host and application are you using to build this VM?



  • @DustinB3403 said:

    Out of curiosity, what host and application are you using to build this VM?

    I have never seen screens like that, so my first guess would be XenServer, because I have not set it up yet. But since you asked, now I assume a third party tool?



  • Yeah that doesn't look line Xen at all, unless he has a 3rd party Xen Management tool from which he's doing this.



  • Could be XenOrchestra. Their web interface is kind of similar.



  • @DustinB3403 said:

    Very nice topic.

    Out of curiosity, what host and application are you using to build this VM?

    That's a Scale HC3.



  • I thought that screen looked familiar, lol.