How to install an NFS server on Debian

A Debian host needs the packaged kernel NFS server components before it can publish directories to Linux, macOS, or Windows clients. Installing nfs-kernel-server adds the server daemon, export management tools, default configuration files, and systemd units used by later export rules.

The Debian package path keeps the server aligned with distribution security updates and service naming. It also installs nfs-common dependencies used by both server and client tooling, while leaving export paths, allowed client networks, firewall rules, and protocol policy for separate configuration steps.

The base install is ready when APT reports nfs-kernel-server installed, rpc.nfsd and exportfs are available, and nfs-server.service starts on the real Debian host. A newly installed server can have an empty active export table until /etc/exports or /etc/exports.d contains a share definition.

Steps to install an NFS server on Debian:

  1. Open a terminal with sudo privileges on the Debian server.
  2. Refresh the package index.
    $ sudo apt update
  3. Install the NFS server package.
    $ sudo apt install --assume-yes nfs-kernel-server

    The nfs-kernel-server package installs the kernel-backed server support and pulls in nfs-common. Client-only hosts use nfs-common without the server package.

  4. Confirm the installed NFS packages.
    $ dpkg-query -W nfs-kernel-server nfs-common
    nfs-common	1:2.8.3-1
    nfs-kernel-server	1:2.8.3-1

    The exact versions differ between Debian releases and security updates. Both package names should appear with installed versions.

  5. Confirm the kernel server daemon is available.
    $ command -v rpc.nfsd
    /usr/sbin/rpc.nfsd

    rpc.nfsd serves client requests through the Linux kernel NFS server. Minimal containers can confirm the installed file, but a real systemd host is needed to start the service.

  6. Confirm the export management command is available.
    $ command -v exportfs
    /usr/sbin/exportfs
  7. Enable the NFS server at boot and start it now.
    $ sudo systemctl enable --now nfs-server

    Current Debian packages also ship nfs-kernel-server.service with the same service body. Use nfs-server for consistency with follow-up status and export checks.

  8. Confirm the NFS server unit is active.
    $ sudo systemctl is-active nfs-server
    active

    If this command does not return active, inspect sudo journalctl -u nfs-server before creating exports or opening firewall rules.

  9. Check the active export table before adding shares.
    $ sudo exportfs -v

    No output is expected on a newly installed server with no export definitions. After adding an export, this command should show the local path, client selector, and active options.