{"id":19020,"date":"2015-08-31T06:43:29","date_gmt":"2015-08-30T22:43:29","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2015\/08\/31\/%e5%82%99%e4%bb%bd-server-%e8%b3%87%e6%96%99%e5%88%b0-nas-debian-ubuntu-server-%e7%af%87\/"},"modified":"2015-08-31T06:43:29","modified_gmt":"2015-08-30T22:43:29","slug":"%e5%82%99%e4%bb%bd-server-%e8%b3%87%e6%96%99%e5%88%b0-nas-debian-ubuntu-server-%e7%af%87","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2015\/08\/31\/%e5%82%99%e4%bb%bd-server-%e8%b3%87%e6%96%99%e5%88%b0-nas-debian-ubuntu-server-%e7%af%87\/","title":{"rendered":"\u5099\u4efd Server \u8cc7\u6599\u5230 NAS &#8211; Debian \/ Ubuntu Server \u7bc7"},"content":{"rendered":"<p>NAS Server\uff1a<span style=\"color: #0000ff;\">192.168.1.5<\/span> <br \/>Debian \/ Ubuntu Server\uff1a<span style=\"color: #0000ff;\">192.168.1.17<\/span> <\/p>\n<p>@ Debain \/ Ubuntu Server <br \/>1. \u5b89\u88dd\u6240\u9808\u5957\u4ef6 <br \/># <span style=\"color: #ff0000;\">apt-get install autofs rpcbind nfs-common<\/span> <\/p>\n<p>2. \u4fee\u6539 autofs \u8a2d\u5b9a\u6a94 <br \/>#<span style=\"color: #ff0000;\"> echo &#8220;\/mnt\/nasnfs\u00a0\u00a0\u00a0\u00a0 \/etc\/auto.nas&#8221; &gt;&gt; \/etc\/auto.master<\/span> <br \/># <span style=\"color: #ff0000;\">echo &#8220;debian 192.168.1.5:\/volume1\/homes\/t850008\/Server\/debian&#8221; &gt; \/etc\/auto.nas[@more@]<\/span><\/p>\n<p>3. \u91cd\u65b0\u555f\u52d5 autofs<br \/># <span style=\"color: #ff0000;\">\/etc\/init.d\/autofs restart<\/span><\/p>\n<p>4. \u958b\u555f\u9632\u706b\u7246\u8b93 Debian \/ Ubuntu Server \u53ef\u4ee5\u9023\u7dda\u5230 NAS \u7684 NFS Server\uff0c\u9810\u8a2d\u60c5\u6cc1\u662f\u6709\u9650\u5236\u5c0d\u5916\u9023\u7dda<br \/># <span style=\"color: #ff0000;\">iptables -P OUTPUT DROP<\/span><br \/># <span style=\"color: #ff0000;\">iptables -A OUTPUT -o eth0 -p tcp -d 192.168.1.5 -m multiport &#8211;dport 111,892,2049 &#8211;syn -m state &#8211;state NEW -j ACCEPT<\/span><br \/># <span style=\"color: #ff0000;\">iptables -A OUTPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT<\/span><\/p>\n<p>5. \u5207\u63db\u5230 \/mnt\/nasnfs\/debian \u76ee\u9304\uff0c\u5982\u679c\u53ef\u4ee5\u6b63\u5e38\u5207\u63db\u5230\u8a72\u76ee\u9304\uff0c\u4ee3\u8868\u4e0a\u9762\u7684\u8a2d\u5b9a\u6210\u529f<br \/># <span style=\"color: #ff0000;\">cd \/mnt\/nasnfs\/debian<\/span><\/p>\n<p>6. \u5c07\u8981\u5099\u4efd\u7684\u8a2d\u5b9a\u6a94\u53ca\u8cc7\u6599\u5beb\u5165\u5230 Script\uff0c\u4e26\u653e\u5165\u5de5\u4f5c\u6392\u7a0b<br \/>\u4f8b\uff1a<br \/># <span style=\"color: #ff0000;\">cat \/usr\/local\/bin\/backuptonas<\/span><br \/><span style=\"color: #0000ff;\">!\/bin\/bash<\/span><br \/><span style=\"color: #0000ff;\"># \u5099\u4efd\u5e33\u865f\u5bc6\u6a94<\/span><br \/><span style=\"color: #0000ff;\">cp \/etc\/passwd \/mnt\/nasnfs\/debian\/set\/passwd_`date +%F`<\/span><br \/><span style=\"color: #0000ff;\">cp \/etc\/shadow \/mnt\/nasnfs\/debian\/set\/shadow_`date +%F`<\/span><br \/><span style=\"color: #0000ff;\">cp \/etc\/group \/mnt\/nasnfs\/debian\/set\/group_`date +%F`<\/span><br \/><span style=\"color: #0000ff;\">cp \/etc\/gshadow \/mnt\/nasnfs\/debian\/set\/gshadow_`date +%F`<\/span><br \/><span style=\"color: #0000ff;\"># mirror \u7db2\u9801\u8cc7\u6599<\/span><br \/><span style=\"color: #0000ff;\"># \/mnt\/nasnfs\/debian\/html \u76ee\u9304\u8981\u5148\u5efa\u597d<\/span><br \/><span style=\"color: #0000ff;\">\/usr\/bin\/mirrordir \/var\/www\/html \/mnt\/nasnfs\/debian\/html<\/span><\/p>\n<p>7. \u66f4\u6539\u6a94\u6848\u5c6c\u6027<br \/># <span style=\"color: #ff0000;\">chmod +x \/usr\/local\/bin\/backuptonas<\/span><\/p>\n<p>8. \u52a0\u5165\u5de5\u4f5c\u6392\u7a0b\uff0c\u6bcf\u5929\u65e9\u4e0a 3 \u6642\u5099\u4efd<br \/># <span style=\"color: #ff0000;\">echo &#8220;0 3 * * * \/usr\/local\/bin\/backuptonas&#8221; &gt;&gt; \/var\/spool\/cron\/crontabs\/root<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NAS Server\uff1a192.168.1.5 Debian \/ Ubuntu Server\uff1a192.168.1 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2015\/08\/31\/%e5%82%99%e4%bb%bd-server-%e8%b3%87%e6%96%99%e5%88%b0-nas-debian-ubuntu-server-%e7%af%87\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u5099\u4efd Server \u8cc7\u6599\u5230 NAS &#8211; Debian \/ Ubuntu Server \u7bc7\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[179,119,110],"tags":[],"class_list":["post-19020","post","type-post","status-publish","format-standard","hentry","category-c-87877","category-c-78464","category-c-72494"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["591610"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19020"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19020"}],"version-history":[{"count":0,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19020\/revisions"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}