MirrorNest
← Tous les guides

NFS server on Ubuntu

NFS (Network File System) shares folders between Linux/Unix machines with lower overhead than Samba — the standard choice when every client is Linux, such as sharing storage between a home server and a Proxmox/VM cluster.

Système : Ubuntu 22.04 LTS / 24.04 LTSfile-sharingNFSLinux-to-LinuxSite officiel ↗Documentation officielle ↗
Ce guide est élaboré à partir de la documentation officielle de NFS server on Ubuntu, dont le lien figure ci-dessus — vérifiez toujours les noms exacts des paquets/versions avant d'exécuter ces commandes sur un serveur de production, car les versions de la distribution et du projet évoluent avec le temps.
  1. 1Install the NFS server

    sudo apt update
    sudo apt install -y nfs-kernel-server
    sudo mkdir -p /srv/nfs/shared
    sudo chown nobody:nogroup /srv/nfs/shared
  2. 2Export the share

    Add an entry to /etc/exports naming the folder and which client IPs/subnets may mount it.

    echo '/srv/nfs/shared 192.168.1.0/24(rw,sync,no_subtree_check)' | sudo tee -a /etc/exports
    sudo exportfs -ra
    sudo systemctl restart nfs-kernel-server
  3. 3Mount it from a Linux client

    sudo apt install -y nfs-common
    sudo mkdir -p /mnt/nfs-shared
    sudo mount server-ip:/srv/nfs/shared /mnt/nfs-shared

    Add an entry to /etc/fstab on the client to make the mount persist across reboots, rather than remounting it manually every time.