nfs 文件共享搭建

1.安装rpcbind ,nfs-tools

参考该连接
rpm -qa rpcbind nfs-tools//检查是否已安装次工具html

yum install rpcbind nfs-tools -y vim

yum install net-tools lsof -y //安装端口检查和服务的工具服务器

2.启动rpcbind

systemctl status rpcbind
systemctl start rpcbind

lsof -i :111 //查看rpcbind 111端口是否开启

netstat -tulnp | grep rpcbind //检查rpcbind 服务

2.1查看nfs服务向rpc注册的端口信息

rpcinfo -p localhost 此时nfs 还没开启,因此没太多的注册端口信息工具

检查rpcbind 是否开机启动
systemctl is-enabled rpcbind 测试

3.开启nfs

systemclt start nfscode

systemclt status nfshtm

3.1 建立共享目录

mkdir /data
chown -R nfsnobody:nfsnobody /data

3.2 服务端nfs 配置

vim /etc/exprots

/data 192.168.100.0/24(rw,sync)
`ps:` 该ip 为nfs客户端的ip 


`exports -rv` 让配置生效

`cat /var/lib/nfs/etab` 查看nfs 开始的参数,包含默认的参数

3.3 测试服务端可否本身挂载

mkdir /data2
mount -t nfs 192.168.100.128:/data /data2
df -h

3.4查看nfs 服务器链接了哪些客户端

cat /var/lib/nfs/rmtabblog

4.客户端链接nfs服务端

yum install rpcbind nfs-tools -yip

systemctl start rpcbindci

yum install showmount -y

showmount -e 192.168.100.128 //查看客户端是否有权限链接nfs服务端机器

ps: 这里要提早关闭nfs 服务端的防火墙,该命令为

systemctl stop firewalld

4.1 挂载

mount -t nfs 192.168.100.128:/data /data2

查看 df -h

相关文章
相关标签/搜索