nfs文件共享

nfs 是什么
FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过
TCP/IP网络共享资源

centos安装 NFS 服务

服务端

$ yum install -y nfs-utils rpcbind

客户端

$ yum install -y nfs-utils

启动
我们先启动 RPC 服务
$ service rpcbind start

或者使用如下命令亦可

$ /bin/systemctl start rpcbind.service

查看 NFS 服务项 rpc 服务器注册的端口列表

$ rpcinfo -p localhost

启动 NFS 服务

$ service nfs start

或者使用如下命令亦可

/bin/systemctl start nfs.service

启动 NFS 服务后 rpc 服务已经启用了对 NFS 的端口映射列表

rpcinfo -p localhost

常用命令
service nfs start
service nfs status
service nfs stop
showmount -e 查看本机发布的共享目录
客户端 showmount -e 服务端ip 查看服务器的目录

showmount -e 192.168.43.60
配置文件位置
/etc/exports
修改配置

/nfs 192.168.1.0/24 (rw,sync,no_root_squash)

/nfs #代表共享出来的目录

192.168.1.0/24 #允许192.168.1.0/24的网络访问此共享。 可以直接配置ip或者 (所有网络)或者 192.168.1.

rw #表示权限 读写

sync #表示同步写入

no_root_squash #表示客户机以root访问时赋予本地root权限

多个网络demo
/fns 192.168.1.0/24 (rw,sync,no_root_squash) 192.168.2.0/24 (rw)

客户端配置
#创建共享目录
mkdir /nfs

同步共享(serverip)
mount 192.168.1.1:/nfs /nfs/

挂载后就可以看到服务器的文件了

常见错误
clnt_create: RPC: Program not registered

解决方法:
在服务器端输入
rpc.mountd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值