CentOS中配置NFS服务

来源:互联网 发布:小白软件库 编辑:程序博客网 时间:2024/06/06 09:37

1.服务器端安装rpcbind、nfs-utils、nfs-server包

yum install nfs-utils -y

2.修改服务器端配置文件,添加需要共享的文件夹。

vim /etc/report.conf

/share1 172.25.1.11/24(rw,async)     允许读写

/share2 172.25.1.11/24(ro,async) 只读模式

3.首先查看rpcbind(远程过程调用)允许状态  

systemctl status rpcbind   如果没有开启用start开启

4.开启nfs服务

systemctl start nfs-server

5.客户端必须安装nfs-utils,然后可以使用命令查看是服务器有没有开启nfs服务

showmount  -e 17.25.1.11

/share1 172.25.1.11/24

/share2 172.25.1.11/24

6.可以手工挂载

mount -t nfs 172.25.1.11:/share1 /mnt/nfs1

  mount -t nfs 172.25.1.11:/share2 /mnt/nfs2

7.也可以进行手工挂载,编辑fstab文件

vim /etc/fstab

172.25.1.11:/share1 /mnt/nfs1 nfs  defaults 0 0

172.25.1.11:/share2 /mnt/nfs2 nfs defaults 0 0

8.使用mount -a挂载,df -h 可以看到共享文件成功挂载