NFS的使用

第一台:

1.准备一台服务器当存储服务器。在其上部署nfs(192.168.135.129)

yum -y install rpcbind nfs-utils

 

2.开启nfs

systemctl start rpcbind
systemctl start nfs

3.准备一个共享的目录

mkdir /opt/html
vim /etc/exports
/opt/html       192.168.135.0/24(rw,no_root_squash)

4.重载共享配置文件

exportfs -rv
systemctl stop firewalld
setenforce 0

第二台:

在客户端挂在该共享目录

yum -y install nfs-utils
开启nfs服务
systemctl start rpcbind
systemctl start nfs showmount -e 192.168.135.129

如果可以看到共享目录,说明可以执行挂载该目录了

mount -t nfs 192.168.135.129:/opt/html /var/www/html

执行mount命令查看是否挂载成功

mount

看到如下输出说明挂载成功

192.168.135.130.:/opt/html on /var/www/html type nfs (rw,vers=4,addr=192.168.135.130,clientaddr=192.168.135.130)

posted @ 2019-12-17 20:11  速溶咖啡  阅读(125)  评论(0)    收藏  举报