{"id":2387,"date":"2022-09-05T15:19:48","date_gmt":"2022-09-05T07:19:48","guid":{"rendered":"https:\/\/199604.com\/?p=2387"},"modified":"2022-09-05T15:19:48","modified_gmt":"2022-09-05T07:19:48","slug":"centos7-%e7%ae%80%e5%8d%95%e6%90%ad%e5%bb%banfs%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/199604.com\/2387","title":{"rendered":"Centos7 &#8211; \u7b80\u5355\u642d\u5efanfs\u670d\u52a1"},"content":{"rendered":"<h1>Centos7 &#8211; \u7b80\u5355\u642d\u5efanfs\u670d\u52a1<\/h1>\n<h2>\u5728\u670d\u52a1\u5668\u7aef\u7684\u64cd\u4f5c\uff08IP\u5730\u5740\uff1a192.168.100.105\uff09<\/h2>\n<h3>yum\u5b89\u88c5nfs\u670d\u52a1<\/h3>\n<p><code>yum -y install rpcbind nfs-utils<\/code><\/p>\n<h3>\u5173\u95ed\u9632\u706b\u5899\uff08\u6216\u8005\u4f7f\u7528firewall-cmd\u589e\u52a0\u6c38\u4e45\u7684\u670d\u52a1\uff09<\/h3>\n<p><code>systemctl stop firewalld<\/code><\/p>\n<h3>\u521b\u5efanfs\u7684\u5171\u4eab\u6587\u4ef6\u5939\uff0c\u6bd4\u5982 \/nfs_data<\/h3>\n<p><code>mkdir \/nfs_data<\/code><\/p>\n<h4><strong>\u5bf9\u5e94\u76ee\u5f55\u7684\u6240\u6709\u8005\u6240\u5c5e\u8005\u6743\u9650\u4fee\u6539<\/strong><\/h4>\n<p><code>chown -R nfsnobody:nfsnobody \/nfs_data<\/code><\/p>\n<h4>\u5728nfs\u76ee\u5f55\u4e0b\u540c\u65f6\u521b\u5efa\u4e94\u4e2a\u6587\u4ef6tests1\u5230tests5<\/h4>\n<p><code>touch  tests{1..5}<\/code><\/p>\n<h3>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p><code>vi \/etc\/exports<\/code><\/p>\n<p>\u6dfb\u52a0\u5185\u5bb9\u4e3a\uff1a<\/p>\n<p><code>\/nfs_data   192.168.100.0\/24(rw,sync)<\/code><\/p>\n<p>\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\/public<\/th>\n<th>\u9700\u8981\u5171\u4eab\u7ed9\u5176\u4ed6\u673a\u5668\u7684\u76ee\u5f55<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>*<\/td>\n<td>\u5176\u4ed6\u673a\u5668\u7684IP\u5730\u5740\uff0c*\u4ee3\u8868\u4efb\u610f\u673a\u5668\u90fd\u53ef\u4ee5\u8bbf\u95ee<\/td>\n<\/tr>\n<tr>\n<td>ro<\/td>\n<td>\u8be5\u4e3b\u673a\u5bf9\u8be5\u5171\u4eab\u76ee\u5f55\u6709\u53ea\u8bfb\u6743\u9650<\/td>\n<\/tr>\n<tr>\n<td>rw<\/td>\n<td>\u64cd\u4f5c\u6743\u9650\uff0crw\u4ee3\u8868\u5176\u4ed6\u673a\u5668\u5bf9\u6b64\u76ee\u5f55\u5177\u6709\u53ef\u8bfb\u5199\u6743\u9650<\/td>\n<\/tr>\n<tr>\n<td>async<\/td>\n<td>\u8d44\u6599\u4f1a\u5148\u6682\u5b58\u4e8e\u5185\u5b58\u4e2d\uff0c\u800c\u975e\u76f4\u63a5\u5199\u5165\u786c\u76d8<\/td>\n<\/tr>\n<tr>\n<td>sync<\/td>\n<td>Sync \u8d44\u6599\u540c\u6b65\u5199\u5165\u5230\u5185\u5b58\u4e0e\u786c\u76d8\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>root_squash<\/td>\n<td>\u5ba2\u6237\u673a\u7528root\u7528\u6237\u8bbf\u95ee\u8be5\u5171\u4eab\u6587\u4ef6\u5939\u65f6\uff0c\u5c06root\u7528\u6237\u6620\u5c04\u6210\u533f\u540d\u7528\u6237<\/td>\n<\/tr>\n<tr>\n<td>no_root_squash<\/td>\n<td>\u5ba2\u6237\u673a\u7528root\u8bbf\u95ee\u8be5\u5171\u4eab\u6587\u4ef6\u5939\u65f6\uff0c\u4e0d\u6620\u5c04root\u7528\u6237<\/td>\n<\/tr>\n<tr>\n<td>all_squash<\/td>\n<td>\u5ba2\u6237\u673a\u4e0a\u7684\u4efb\u4f55\u7528\u6237\u8bbf\u95ee\u8be5\u5171\u4eab\u76ee\u5f55\u65f6\u90fd\u6620\u5c04\u6210\u533f\u540d\u7528\u6237<\/td>\n<\/tr>\n<tr>\n<td>anonuid<\/td>\n<td>\u5ba2\u6237\u673a\u4e0a\u7684\u7528\u6237\u6620\u5c04\u6210\u6307\u5b9a\u7684\u672c\u5730\u7528\u6237ID\u7684\u7528\u6237<\/td>\n<\/tr>\n<tr>\n<td>anongid<\/td>\n<td>\u5c06\u5ba2\u6237\u673a\u4e0a\u7684\u7528\u6237\u6620\u5c04\u6210\u5c5e\u4e8e\u6307\u5b9a\u7684\u672c\u5730\u7528\u6237\u7ec4ID<\/td>\n<\/tr>\n<tr>\n<td>insecure<\/td>\n<td>\u5141\u8bb8\u4ece\u8fd9\u53f0\u673a\u5668\u8fc7\u6765\u7684\u975e\u6388\u6743\u8bbf\u95ee<\/td>\n<\/tr>\n<tr>\n<td>subtree_check<\/td>\n<td>\u5982\u679c\u5171\u4eab\/usr\/bin\u4e4b\u7c7b\u7684\u5b50\u76ee\u5f55\u65f6\uff0c\u5f3a\u5236NFS\u68c0\u67e5\u7236\u76ee\u5f55\u7684\u6743\u9650\uff08\u9ed8\u8ba4\uff09<\/td>\n<\/tr>\n<tr>\n<td>no_subtree_check<\/td>\n<td>\u4e0d\u68c0\u67e5\u7236\u76ee\u5f55\u6743\u9650<\/td>\n<\/tr>\n<tr>\n<td>no_wdelay<\/td>\n<td>\u5982\u679c\u591a\u4e2a\u7528\u6237\u8981\u5199\u5165NFS\u76ee\u5f55\uff0c\u5219\u7acb\u5373\u5199\u5165\uff0c\u5f53\u4f7f\u7528async\u65f6\uff0c\u65e0\u9700\u6b64\u8bbe\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>wdelay<\/td>\n<td>\u5982\u679c\u591a\u4e2a\u7528\u6237\u8981\u5199\u5165NFS\u76ee\u5f55\uff0c\u5219\u5f52\u7ec4\u5199\u5165<\/td>\n<\/tr>\n<tr>\n<td>no_hide<\/td>\n<td>\u5171\u4eabNFS\u76ee\u5f55\u7684\u5b50\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>hide<\/td>\n<td>\u5728NFS\u5171\u4eab\u76ee\u5f55\u4e2d\u4e0d\u5171\u4eab\u5176\u5b50\u76ee\u5f55<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u542f\u52a8nfs\u670d\u52a1\uff0c\u542f\u52a8rpc\u670d\u52a1<\/h3>\n<p>\u5148\u542f\u52a8rpc\u670d\u52a1\uff0c\u518d\u542f\u52a8nfs\u670d\u52a1<\/p>\n<pre><code class=\"language-shell \">systemctl start rpcbind \nsystemctl enable rpcbind \nsystemctl start nfs-server\nsystemctl enable nfs-server\n<\/code><\/pre>\n<blockquote><p>\n  <strong>\u6267\u884cexportfs -rv \u547d\u4ee4\uff0cnfs\u4f1a\u91cd\u65b0\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\uff0c\u65e0\u9700\u91cd\u542fnfs\u670d\u52a1<\/strong>\n<\/p><\/blockquote>\n<h2>\u5728\u5ba2\u6237\u7aef\u4e0a\u7684\u64cd\u4f5c\uff08IP\u5730\u5740\uff1a192.168.100.104\uff09<\/h2>\n<h3>yum\u5b89\u88c5nfs\u670d\u52a1<\/h3>\n<p><code>yum -y install rpcbind nfs-utils<\/code><\/p>\n<h3>\u542f\u52a8nfs\u670d\u52a1\uff0c\u542f\u52a8rpc\u670d\u52a1<\/h3>\n<p>\u5148\u542f\u52a8rpc\u670d\u52a1\uff0c\u518d\u542f\u52a8nfs\u670d\u52a1<\/p>\n<pre><code class=\"language-shell \">systemctl start rpcbind \nsystemctl enable rpcbind \nsystemctl start nfs-server\nsystemctl enable nfs-server\n<\/code><\/pre>\n<h4>\u6d4b\u8bd5\u662f\u5426\u8054\u901a<\/h4>\n<p><code>showmount -e 192.168.100.105<\/code><\/p>\n<h3><strong>\u6302\u8f7d\u5e94\u7528<\/strong><\/h3>\n<h4>\u521b\u5efa\u6302\u8f7d\u70b9<\/h4>\n<p><code>mkdir \/mnt\/nfs_data<\/code><\/p>\n<h4>\u4f7f\u7528mount\u4ee4\u8fdb\u884c\u6302\u8f7d<\/h4>\n<p><code>mount -t nfs 192.168.100.105:\/nfs_data \/mnt\/nfs_data\/<\/code><\/p>\n<h4>\u8fdb\u5165\/mnt\/nfs_data\u76ee\u5f55\u4e0b\u67e5\u770b\u9a8c\u8bc1.<\/h4>\n","protected":false},"excerpt":{"rendered":"<p>Centos7 &#8211; \u7b80\u5355\u642d\u5efanfs\u670d\u52a1 \u5728\u670d\u52a1\u5668\u7aef\u7684\u64cd\u4f5c\uff08IP\u5730\u5740\uff1a192.168.100.105 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[260],"tags":[259,70,414],"class_list":["post-2387","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos","tag-linux","tag-nfs"],"_links":{"self":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/comments?post=2387"}],"version-history":[{"count":1,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2387\/revisions"}],"predecessor-version":[{"id":2388,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2387\/revisions\/2388"}],"wp:attachment":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/media?parent=2387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/categories?post=2387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/tags?post=2387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}