0%

在CentOS 8上配置 NFS Server

由于学习PV的需要,需要一个远程文件系统做基础设施,最简单的是NFS,这里写一下笔记,记录一下。

1、安装服务器软件

1
# dnf -y install nfs* rpcbind

2、配置NFS

创建NFS共享目录

1
# mkdir /deploy/nfs

配置NFS

/etc/exports:

1
2
/deploy/nfs 192.168.0.0/16(rw,no_root_squash,no_all_squash,sync)
/deploy/nfs 10.0.0.0/8(rw,no_root_squash,no_all_squash,sync)

使NFS配置生效:

1
# exportfs -r

3、启动NFS相关服务

1
2
3
4
5
# systemctl enable rpcbind.service
# systemctl enable nfs-server.service

# systemctl start rpcbind.service
# systemctl start nfs-server.service

4、检查配置情况:

1
2
3
4
5
6
7
# showmount -e 192.168.55.55
Export list for 192.168.55.55:
/deploy/nfs 10.0.0.0/8,192.168.0.0/16

# exportfs
/deploy/nfs 192.168.0.0/16
/deploy/nfs 10.0.0.0/8

5、挂载测试

1
# mount -t nfs 192.168.55.55:/deploy/nfs /root/test