Nfs File Share Ubuntu 22.04 Setup – Step-by-step

December 28, 2022 | By the+gnu+linux+evangelist.

GNU/Linux Ubuntu 22.04 Nfs File Sharing – QuickStart Guide

Hi! The Tutorial shows you Step-by-Step How to Setup Nfs File Share in Ubuntu 22.04 Jammy LTS GNU/Linux.

Network File System (NFS) is a distributed File System Protocol originally developed by Sun Microsystems (Sun) in 1984, allowing a user on a Client Computer to access files over a computer Network much like local Storage is accessed.

And with this SetUp you’ll be able to Nfs Sharing Files on Ubuntu 22.04 to Local and Remote Clients.

Moreover, with this same File Sharing Setup will Works for a Network Composed of Debian/Ubuntu Based Systems.

The “rpcbind” Package have Replaced the Old “portmap” and “nfs-kernel-server” Service the Precedent “nfs-common” one.

Finally, this Setup is valid for all the Ubuntu-based Distros like:

  • Linux Mint
  • Zorin OS
  • Lubuntu
  • Elementary OS
  • Kde Neon
  • Pop_OS!
  • Xubuntu
  • Linux Lite
  • Bodhi
  • Puppy
  • Kubuntu
  • LXLE
  • Trisquel
  • Voyager Ubuntu
  • feren OS
  • Peppermint
  • Linux Ultimate Edition
Nfs File Share Ubuntu 22.04 Jammy Setup Easy Guide - Featured
  1. Terminal Getting-Started Guide

    How to QuickStart with Command Line on Ubuntu GNU/Linux:

    Console Ubuntu QuickStart Guide

    First Update the Apt Repo Sources with:

    sudo apt update
    Authenticate with the User Admin Pass.
    If Got “User is Not in Sudoers file” then see: How to Enable sudo.
[nextpage title=”Setting Up Server”]
  1. Setting up Server

    1. 1. Accessing Shell

      Open a Shell Session
      Terminal Window on a Desktop
      (Press “Enter” to Execute Commands)

    2. 2. Installing Software

      Now Install Required Packages
      With:

      sudo apt install nfs-kernel-server rpcbind nfs-common
    3. 3. Configuring

      Again

      Make Configuration.

      1. Configure rpcbind.

        sudo nano /etc/default/rpcbind

        Append:

        OPTIONS=""

        Ctrl+x to Save & Exit from nano Editor.

        Again:

        sudo nano /etc/hosts.allow

        For Example on a Local Network:

        portmap: 192.168.1.

        To Find your Machine IP Address do:

        ifconfig

        In this Example Allow 192.168.1.0/24 to be Accessed on Network.

      2. Configure idmapd.

        sudo nano /etc/default
        fs-common

        Inserts:

        NEED_IDMAPD=YES

        Then:

        sudo nano /etc/idmapd.conf

        The Content should Correspond to:

        [General]
        Verbosity = 0
        Pipefs-Directory = /var/lib
        fs/rpc_pipefs
        Domain = localdomain
        [Mapping]
        Nobody-User = nobody
        Nobody-Group = nogroup
        
      3. Configure NFS.

        sudo nano /etc/exports

        Append something Like:

        /exports  192.168.1.0/255.255.255.0(rw,no_root_squash,no_subtree_check,crossmnt,fsid=0)
    4. 4. Bindinding Directories

      Now Make and Bind the Sharing Directories.

      sudo mkdir -p /exports/home

      Then to Bind your home to /exports/home do:

      cd /exports
      sudo mount --bind /home ./home

      To have this SetUp Loaded on Boot Edit fstab:

      sudo nano /etc/fstab

      Appending like in Example:

      /home /exports/home none bind
    5. 5. Starting Services

      Now StartUp server File Sharing over Network Services
      Run:

      sudo /etc/init.d
      fs-kernel-server start
      And again:
      sudo /etc/init.d/rpcbind start
[nextpage title=”Setting Up Client”]
  1. Setting up Client

    1. 1. Launching Terminal

      Open a Terminal Window.

    2. 2. Installing Software

      And Install Required Packages
      Simply play:

      sudo apt install nfs-common rpcbind
    3. 3. Mounting Directories

      How to Mount the Sharing Directories on the Client
      To Mount the entire Remote Sharing Folder:

      mount.nfs4 192.168.1.4:/ /data
      Instead to mount only a Sub-directory:
      mount.nfs4 192.168.1.4:/data /data
      Replace as needed “data” in the above Command.
  2. So After this SetUp a Portion of your Choice on the Ubuntu 22.04 Jammy File Sharing Server will be Shared with the Enabled Ubuntu/Debian-based Clients on Network.