Linux之NFS配置

1.服务端安装
yum -y install nfs-utils rpcbind
rpm -qa nfs-utils rpcbind

启动RPC
systemctl start rpcbind
systemctl enable rpcbind

查看注册端口
rpcinfo -p 127.0.0.1

启动nfs
systemctl start nfs
systemctl enable nfs

实践:
[root@nfs01 ~]$vi /etc/exports
/data 172.16.1.0/24(rw,sync)

[root@nfs01 ~]$tail /etc/exports
/data 172.16.1.0/24(rw,sync)

[root@nfs01 ~]$mkdir -p /data

重新加载nfs,两种方法
[root@nfs01 ~]$systemctl reload nfs
[root@nfs01 ~]$exportfs -r

目录授权
[root@nfs01 ~]$chown -R nfsnobody.nfsnobody /data/
[root@nfs01 ~]$ll -d /data/
drwxr-xr-x 2 nfsnobody nfsnobody 45 Nov  5 16:18 /data/

检查
[root@nfs01 ~]$showmount -e 172.16.1.31
Export list for 172.16.1.31:
/data 172.16.1.0/24

服务本地挂载测试
[root@nfs01 ~]$mount -t nfs 172.16.1.31:/data /mnt

2.客户端安装
#客户端安装nfs-utils是为了使用showmount命令
yum -y install nfs-utils rpcbind 
rpm -qa nfs-utils rpcbind

启动RPC即可
systemctl start rpcbind
systemctl enable rpcbind

#查看
[root@web01 ~]$showmount -e 172.16.1.31
Export list for 172.16.1.31:
/data 172.16.1.0/24

挂载
[root@web01 ~]mount -t nfs 172.16.1.31:/data /mnt

NFS开机自启动配置:https://www.shnne.com/post/585.html

分享到:
关键词:Linux运维

网友留言(0 条)

发表评论