[root@nfs ~]# yum -y install nfs-utils
[root@nfs ~]# mkdir /code
[root@nfs ~]# vim /etc/exports
/code * (rw)
[root@nfs ~]# chmod 777 /code/
[root@nfs ~]# systemctl start nfs-server.service
客户端rs1rs2 挂载
yum -y install nfs-utils
systemctl restart nfs-server
yum -y install rpcbind
systemctl enable --now nfs-server rpcbind
showmount -e 192.168.26.105 测试
Export list for 192.168.26.105:
/code * #以上rs1,2都执行
[root@rs1 ~]# tar zcf xkf.tar.gz /usr/share/nginx/html/
tar: Removing leading `/' from member names
[root@rs1 ~]# ls
\ anaconda-ks.cfg wordpress wordpress-6.0.1-zh_CN.tar.gz xkf.tar.gz
[root@rs1 ~]# scp xkf.tar.gz root@192.168.26.105:/root
[root@nfs ~]# tar xf xkf.tar.gz
[root@nfs ~]# cd usr/share/nginx/html/
[root@nfs html]# cd ..
[root@nfs nginx]# mv html/* /code
[root@nfs nginx]# ls /code/
404.html img nginx-logo.png wp-admin wp-config-sample.php wp-links-opml.php wp-settings.php
50x.html index.html poweredby.png wp-blog-header.php wp-content wp-load.php wp-signup.php
en-US index.php readme.html wp-comments-post.php wp-cron.php wp-login.php wp-trackback.php
icons license.txt wp-activate.php wp-config.php wp-includes wp-mail.php xmlrpc.php
[root@rs1 ~]# mount -t nfs 192.168.26.105:/code /usr/share/nginx/html/
[root@rs1 ~]# df -Th
192.168.26.105:/code nfs4 40G 1.7G 39G 5% /usr/share/nginx/html
[root@rs2 php-7.4.11]# showmount -e 192.168.26.105
Export list for 192.168.26.105:
/code *
[root@rs2 php-7.4.11]# mount -t nfs 192.168.26.105:/code /usr/share/nginx/html/
[root@rs2 php-7.4.11]# df -Th
192.168.26.105:/code nfs4 40G 1.7G 39G 5% /usr/share/nginx/htm