Preface

NFS Server configuration

  • install software

    sudo apt install nfs-kernel-server -y
  • Create a shared directory

    sudo mkdir -p /mnt/nfs_share
  • Modify the owner and read and write permissions of the shared directory

    sudo chown -R nobody:nogroup /mnt/nfs_share/
    sudo chmod 777 /mnt/nfs_share/
  • Edit /etc/exports , modify the permissions of the shared directory to the client

    /mnt/nfs_share  192.168.1.222/32(rw,sync,no_subtree_check)
  • Restart the service for the configuration to take effect

    sudo exportfs -a
    sudo systemctl restart nfs-kernel-server

NFS Client configuration

  • install software

    sudo apt install nfs-common -y
  • Create mount point

    sudo mkdir -p /mnt/nfs_share
  • Mount the shared directory

    sudo mount 192.168.1.111:/mnt/nfs_share  /mnt/nfs_share
  • Automatically mount at /etc/fstab , add in 060b732b862d2d

    192.168.1.111:/mnt/nfs_share  /mnt/nfs_share nfs  rw 0 0

verification

  • Create a file on the client

    cd /mnt/nfs_share
    echo HaHaHa > h.txt
  • Go to the server to view

    cd /mnt/nfs_share
    cat h.txt
This article is from qbit snap

qbit
268 声望279 粉丝