由于服务器部署在内网,无法yum安装nfs服务进行文件挂载共享,只能手工下载nfs的安装组件,和依赖的组件进行手动安装。服务器端需要安装nfs_util和rpcbind,客户端只需要安装nfs_util。自己也是花比较长的时间去网上找各种资料,以及安装教程,期间由于网上的资源包不齐全,尝试多个版本都没有成功。最后整理了一个能够15分钟完成安装和配置的nfs资料(包括nfs_util和rpcbind的各种依赖包),附带自己操作的Linux安装命令行,共享给大家。
nfs_util和rpcbind安装包和安装步骤教程:https://download.youkuaiyun.com/download/caiws0603/85573277
期间对服务器安装nfs_util和rpcbind,客户端安装nfs_util,挂载共享没生效。索性我也把客户端的nfs_util和rpcbind装上,两台服务器启动nfs_util和rpcbind,文件挂载共享生效了。
1、安装rpcbind 和nfs_util,进入两个文件夹目录,各自执行
[root@1921683118 nfs_util]#rpm -ivh *.rpm --force --nodeps
2、查看安装情况
[root@1921683118 nfs_util]# rpm -qa|grep nfs
[root@1921683118 nfs_util]# rpm -qa|grep rpcbind
3、服务端配置共享目录(如客户端可略过)
[root@cs-oa-web /]# vi /etc/exports
配置内容:
/home/web/POC *(insecure,rw,async,no_root_squash)
/home/web 192.168.3.67(rw)
或者直接配置exports
192.XXX.0.3/32为客户端挂载IP区间
echo “/app/nfsdir 192.XXX.0.3/32(insecure,rw,sync,no_root_squash)” > /etc/exports
生效命令:
[root@cs-oa-web /]# exportfs -arv
4、 设置开机启动
[root@1921683118 nfs_util]# systemctl enable nfs
5、重启rpcbind和nfs
[root@1921683118 nfs_util]#systemctl restart rpcbind.service
[root@1921683118 nfs_util]#systemctl restart nfs
--
-- 停止
service rpcbind stop
service nfs stop
-- 启动
service rpcbind start
service nfs start
--查看状态
service rpcbind status
service nfs status
6、取消挂载
查看占用命令:fuser -mv /home/data_azkaban
杀死占用命令:fuser -kv /home/data_azkaban
取消挂载命令:umount -a