首先安装yum install nfs-utils
配置nfs:修改/etc/exports 文件 /dsx01/(可用于挂载的目录) *(*表示任意IP地址)(insecure,rw,sync,no_root_squash)权限配置,具体参考172.16.15.3配置方式
重启nfs服务:service nfs restart
挂载nfs方式:mont -t nfs xxx.xxx.xxx.xxx:/xx/xx /xxx/xxx/
我之前安装这种方式安装没有问题,换了台物理机后,就报错了:
[root@sugon02 dsx01]# service nfs restart Redirecting to /bin/systemctl restart nfs.service Job for nfs-server.service Failed because the control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details.
接着跟踪错误:
[root@sugon02 dsx01]# systemctl status nfs-server.service ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled) Active: Failed (Result: exit-code) since Fri 2017-02-24 15:19:08 CST; 28s ago Process: 2662 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited,status=1/FAILURE) Process: 2659 ExecStartPre=/usr/sbin/exportfs -r (code=exited,status=0/SUCCESS) Main PID: 2662 (code=exited,status=1/FAILURE) Feb 24 15:19:08 sugon02 systemd[1]: Starting NFS server and services... Feb 24 15:19:08 sugon02 rpc.nfsd[2662]:rpcbind服务起来之后,nfs服务也跟着拉起来,百度rpcbind了解到:rpc.nfsd: writing fd to kernel Failed: errno 111 (Connection refused)
Feb 24 15:19:08 sugon02 rpc.nfsd[2662]: rpc.nfsd: unable to set any sockets for nfsdFeb 24 15:19:08 sugon02 systemd[1]: nfs-server.service: main process exited,code=exited,status=1/FAILUREFeb 24 15:19:08 sugon02 systemd[1]: Failed to start NFS server and services.Feb 24 15:19:08 sugon02 systemd[1]: Unit nfs-server.service entered Failed state.Feb 24 15:19:08 sugon02 systemd[1]: nfs-server.service Failed. 活的关键信息:rpc.nfsd: writing fd to kernel Failed: errno 111 (Connection refused)百度后知道还有起一个rpcbind服务: @H_403_26@ #service rpcbind restart #service nfs start
RPC即Remote Procedure Call Protocol(远程过程调用协议),RPCBIND用于取代旧版本中的portmap组件。 简单说,RPCBIND就是为了将不同服务与对应的端口进行绑定,以便支持机器间的互操作到这我就成功了,如果还是安装失败,可以安装个portmap 再试试