ubuntu18.04搭建nfs

时间:2022-01-04 16:11:50

1.服务端安装

#apt-get update -y
#apt-get install -y nfs-kernel-server
#apt-get enable nfs-kernel-server

2.选定目录

#mkdir -p /data
#chown nobody:nogroup /data
#chmod /data
#echo "/data 100.100.22.1/24(rw,sync,no_subtree_check)" >> /etc/exports
#exportfs -r
#systemctl restart nfs-kernel-server

3.服务端测试

#showmount -e 127.0.0.1

4.客户端安装

#apt-get update -y
#apt-get install -y nfs-common

5.选定目录

#mkdir -p /data

6.添加挂载

#echo "100.100.22.20:/data /data nfs rw 0 0" >> /etc/fstab
#mount -a

7.联调测试

#touch .txt