Ubuntu配置NFS服务器(Linux挂载Linux)

Ubuntu配置NFS服务器

服务器端的配置

  • Ubuntu安装NFS服务器端
sudo apt-get install nfs-kernel-server

在这里插入图片描述

  • 服务端查看版本
nfsstat -s

在这里插入图片描述

  • 在桌面上创建共享目录
mkdir share

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8aVAZCxe-1668783113133)(E:/markdown%E6%96%87%E4%BB%B6/typroaPic/image-20221118203400562.png)]

  • 修改/etc/export配置文件,在后面添加如下语句
/home/xxx/桌面/share *(rw,sync,no_root_squash)
注意*(rw,sync,no_root_squash)前的空格
xxx:实际用户名
*:允许所有的网段访问,也可以使用具体的IP
rw:挂接此目录的客户端对该共享目录具有读写权限
sync:资料同步写入内存和硬盘
no_root_squash:root用户具有对根目录的完全管理访问权限。
no_subtree_check:不检查父目录的权限

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OsVZqgvW-1668783113133)(E:/markdown%E6%96%87%E4%BB%B6/typroaPic/image-20221118224041474.png)]

  • 重启NFS服务
/etc/init.d/nfs-kernel-server restart

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-MTICD1lK-1668783113135)(E:/markdown%E6%96%87%E4%BB%B6/typroaPic/image-20221118204934428.png)]

客户端的配置

  • Ubuntu安装NFS客户端
sudo apt-get install nfs-common

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uMQ8LXP8-1668783113137)(E:/markdown%E6%96%87%E4%BB%B6/typroaPic/image-20221118201136718.png)]

  • 客户端查看版本
nfsstat -c
  • 客户端挂载服务器的共享目录
 sudo mount -t nfs 192.168.198.130:/home/hkl/桌面/share /home/redamancy/桌面/temp
#使用nfs的方式,把Ubuntu服务器 192.168.198.130:/home/hkl/桌面/share文件,挂载到Ubuntu nfs客户端

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OKQDbrsU-1668783113138)(E:/markdown%E6%96%87%E4%BB%B6/typroaPic/image-20221118224430694.png)]

在服务器中创建一个server.txt文件,然后再客户端查看

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-46KSmXbg-1668783113139)(E:/markdown%E6%96%87%E4%BB%B6/typroaPic/image-20221118224535863.png)]

猜你喜欢

转载自blog.csdn.net/qq_45031509/article/details/127931071