Linux NFS服务配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 服务端配置: 1. 安装nfs-utils和rpcbind #yum install nfs-utils rpcbind 2.设置开机启动服务 #chkconfig nfs on #chkconfig rpcbind on 3.启动相关服务 #service rpcbind start #service nfs start 4.创建共享目录 #mkdir -p /export/libin 5.编辑 /etc/exports 主配置文件添加如下内容 #vi /etc/exports ==> /export/libin *(rw,async,no_root_squash,no_subtree_check) #exportfs -rv //重新读取配置文件,而不中断服务 解读: *可以共享给指定IP(192.168.1.7),也可以共享给指定网段(192.168.1.0),还可以共享给所有IP(*).rw代表读写权限。 ro只读权限 rw读写权限 sync 同步写入内存与磁盘当中 no_all_squash保留共享文件的UID和GID(默认) no_root_squash使得root用户具有根目录的完全访问权限 6.启动nfs和rpcbind ,加入开机自启动: #systemctl start rpcbind #systemctl start nfs #systemctl enable rpcbind #systemctl enable nfs 7.刷新配置立即生效 #exportfs -a 8、查看本机共享的服务 #showmount -e 客户端配置 1. 安装nfs-utils #yum install nfs-utils 2.设置开机启动服务 #chkconfig nfs on 3.启动服务 #service nfs start 4.创建挂载点 #mkdir -p /mnt/libin 5.挂载目录 #mount -t nfs server_ip:/export/libin /mnt/libin 6.查看挂载的目录 #df -h 7.卸载挂载的目录 #umount /mnt/libin 8.编辑 /etc/fstab ,开机自动挂载 #vi /etc/fstab ==>server_ip: /export/libin /mnt/libin nfs rw,tcp,intr 0 1 回退: 服务端:yum remove nfs-utils rpcbind 客户端: #umount /mnt/libin #yum remove nfs-utils |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下