Skip to content

Instantly share code, notes, and snippets.

@kayoch1n
Last active November 23, 2022 09:32
Show Gist options
  • Save kayoch1n/be4f00e346a56735e696a8b876b46d30 to your computer and use it in GitHub Desktop.
Save kayoch1n/be4f00e346a56735e696a8b876b46d30 to your computer and use it in GitHub Desktop.
init NFS server/client on ubuntu
#!/bin/sh
# https://ubuntu.com/server/docs/service-nfs
# client
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/reference_guide/s2-nfs-client-config-options
sudo mount 172.16.0.7:/home/ubuntu/nfsroot /opt/172-16-0-7/ -o nfsvers=2
cat /proc/mounts | grep nfsroot
cat /opt/172-16-0-7/README.md
# sudo umount /opt/172-16-0-7/
#!/bin/sh
# https://ubuntu.com/server/docs/service-nfs
# server
sudo apt install nfs-kernel-server -y
sudo systemctl start nfs-kernel-server.service
# for nfs2 -> https://unix.stackexchange.com/a/603364/325365
mkdir nfsroot -p
sudo exportfs -o rw,async,no_subtree_check,no_root_squash 172.16.0.5:/home/ubuntu/nfsroot/
echo Hello, world! > nfsroot/README.md
# sudo exportfs -ua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment