{"id":139,"date":"2022-02-06T04:03:08","date_gmt":"2022-02-05T20:03:08","guid":{"rendered":"http:\/\/nas.hepcloud.top:7000\/?p=139"},"modified":"2022-11-02T00:16:51","modified_gmt":"2022-11-01T16:16:51","slug":"%e7%be%a4%e6%99%96nas%e6%95%99%e7%a8%8b%e5%9b%9b%e3%80%81%e5%88%a9%e7%94%a8docker%e5%ae%89%e8%a3%85%e6%9c%80%e6%96%b0%e7%89%88ubuntu-21-04%e5%b9%b6%e8%bf%9c%e7%a8%8b%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"http:\/\/www.huerpu.cc:7000\/?p=139","title":{"rendered":"\u7fa4\u6656NAS docker\u7cfb\u5217\u6559\u7a0b(\u56db)\u3001\u5229\u7528Docker\u5b89\u88c5\u6700\u65b0\u7248Ubuntu-21.04\u5e76\u8fdc\u7a0b\u8bbf\u95ee"},"content":{"rendered":"<h3>\u7fa4\u6656NAS\u6559\u7a0b(\u56db)\u3001\u5229\u7528Docker\u5b89\u88c5\u6700\u65b0\u7248Ubuntu-21.04\u5e76\u8fdc\u7a0b\u8bbf\u95ee<\/h3>\n<p>\u7531\u4e8e\u524d\u9762\u7684\u5199\u7684\u6559\u7a0b\uff0c\u5b89\u88c5\u7684Ubuntu\u7248\u672c\u6bd4\u8f83\u4f4e\uff0c\u6240\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u8ffd\u6c42\u5b8c\u7f8e\u7684\u5c0f\u4f19\u5b50\uff0c\u4eca\u513f\u6298\u817e\u4e00\u4e0b\u6700\u65b0\u7248\u7684Ubuntu-21.04 \u3002<\/p>\n<h3>\u4e00\u3001\u4e0b\u8f7dUbuntu-21.04(LTS)\u6700\u65b0\u7248\u672c\u955c\u50cf<\/h3>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/75.png\" alt=\"img\" \/><\/p>\n<h3>\u4e8c\u3001\u8fd0\u884c\u5bb9\u5668\uff0c\u5e76\u914d\u7f6e\u76f8\u5173\u53c2\u6570<\/h3>\n<p>\u8fd9\u91cc\u53ea\u914d\u7f6e\u4e86Ubuntu\u768422\u7aef\u53e3\u6620\u5c04\u5230\u5916\u7f51\uff0c\u5982\u679c\u9700\u898180\u7b49\u522b\u7684\u7aef\u53e3\u4e5f\u53ef\u4ee5\u5916\u7f51\u8bbf\u95ee\uff0c\u591a\u589e\u52a0\u76f8\u5173\u7aef\u53e3\u6620\u5c04\u5373\u53ef\uff0cso easy\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/76.png\" alt=\"img\" \/><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/77.png\" alt=\"img\" \/><\/p>\n<h3>\u4e09\u3001\u5b89\u88c5ssh<\/h3>\n<p>\u542f\u52a8\u5bb9\u5668\uff0c\u6253\u5f00bash\u547d\u4ee4\u884c\u7a97\u53e3<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/78.png\" alt=\"img\" \/><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/79.png\" alt=\"img\" \/><\/p>\n<p>\u6267\u884c\u5982\u4e0b\u547d\u4ee4<\/p>\n<pre><code>#\u5347\u7ea7\u5b89\u88c5\u5305\napt update\n\n#\u8fdb\u884c\u5b89\u88c5\u5305\u7684\u66f4\u65b0\napt upgrade\n\n#\u5b89\u88c5vim\napt install vim\n\n#\u5b89\u88c5ssh\napt install openssh-server\n\n#\u53ef\u9009\u9879\uff0c\u4e3a\u4e86\u8fde\u63a5\u522b\u7684ssh-server\napt install openssh-client<\/code><\/pre>\n<p>\u8fd9\u91cc\u5e94\u8be5\u662f\u6f2b\u957f\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u5b8c\u6210\u4e4b\u540e\uff0c\u4fee\u6539root\u5bc6\u7801\uff1a<\/p>\n<pre><code>passwd root 123456<\/code><\/pre>\n<p>\u4fee\u6539\u914d\u7f6e\uff0c\u4f7f\u5f97\u5141\u8bb8root\u8fdc\u7a0b\u767b\u5f55<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/80.png\" alt=\"img\" \/><\/p>\n<p>\u6309\u5b57\u6bcd<code>i<\/code>\u8fdb\u884c\u63d2\u5165\u4fee\u6539\u64cd\u4f5c\uff0c\u6309<code>:wq<\/code>\u4fdd\u5b58\u5e76\u9000\u51fa\u3002<\/p>\n<pre><code>#\u5c06PermitRootLogin\u7684\u503c\u6539\u4e3ayes\uff0c\/\u641c\u7d22\u5373\u53ef\uff0c\u8d85\u7ea7\u7b80\u5355\nvim \/etc\/ssh\/sshd_config\n\n#\u91cd\u542fssh\u670d\u52a1\nservice ssh restart<\/code><\/pre>\n<h3>\u56db\u3001\u8def\u7531\u5668\u8bbe\u7f6essh\u7684\u7aef\u53e3\u8f6c\u53d1\u5230\u5916\u7f51<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u540d\u79f0<\/th>\n<th>\u534f\u8bae<\/th>\n<th>\u5916\u90e8\u7aef\u53e3<\/th>\n<th>\u5185\u90e8IP\u5730\u5740<\/th>\n<th>\u5185\u90e8\u7aef\u53e3<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>5022<\/td>\n<td>TCP<\/td>\n<td>5022<\/td>\n<td>192.168.31.19<\/td>\n<td>5022<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u540d\u79f0\u53ef\u4ee5\u968f\u4fbf\u586b\uff0c\u534f\u8bae\u9009\u62e9TCP\uff0c\u5916\u90e8\u7aef\u53e3\u662f\u5916\u7f51\u8bbf\u95ee\u7684\u7aef\u53e3\uff0c\u5185\u90e8IP\u5730\u5740\u662f\u7fa4\u6656\u7684\u672c\u5730IP\uff0c\u5185\u90e8\u7aef\u53e3\u662f\u5bb9\u5668\u66b4\u9732\u7ed9\u5bbf\u4e3b\u673a\u7684\u7aef\u53e3\u53f7\uff0c\u4e3a\u4e86\u65b9\u4fbf\u6211\u4eec\u5168\u90e8\u8bbe\u7f6e\u6210\u4e86\u7edf\u4e00\u76845022\u3002<\/p>\n<h3>\u4e94\u3001\u8fdc\u7a0bSSH\u8fde\u63a5\u6d4b\u8bd5<\/h3>\n<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u7ec8\u7aef\u662fTerminus\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528Xshell\u3001SSH Secure Shell Client\u7b49\u8fdc\u7a0b\u8bbf\u95ee\u8fde\u63a5\u5c0f\u5de5\u5177\uff0c\u5982\u679c\u662fMac\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u6253\u5f00Terminal\u8fdb\u884c\u64cd\u4f5c\u3002Terminus\u754c\u9762\u8d85\u7ea7\u597d\u770b\uff0c\u800c\u4e14win\u3001Mac\u3001Linux\u90fd\u6709\uff0c\u672c\u4eba\u8d85\u7ea7\u559c\u6b22\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/81.png\" alt=\"img\" \/><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/82.png\" alt=\"img\" \/><\/p>\n<p>\u8fde\u63a5\u6210\u529f\uff0c\u5927\u529f\u544a\u6210\u3002<\/p>\n<h3>\u516d\u3001\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8SSH<\/h3>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u73b0\u5728\u8fd8\u6709\u4e00\u4e2a\u81f4\u547d\u7684\u5f31\u70b9\uff0c\u5c31\u662f\u6bcf\u6b21\u673a\u5668\u6216\u8005\u5bb9\u5668\u91cd\u542f\uff0c\u90fd\u9700\u8981\u8fdb\u5165\u5bb9\u5668\u8fdb\u884c\u542f\u52a8ssh\u670d\u52a1\u7684\u64cd\u4f5c\u3002\u6240\u4ee5\u8fdb\u884c\u5f00\u673a\u81ea\u542f\u52a8ssh\u670d\u52a1\u663e\u5f97\u5c24\u4e3a\u91cd\u8981\uff0c\u5176\u5b9e\u4e5f\u8d85\u7ea7\u7b80\u5355\uff0c\u53ea\u9700\u6267\u884c\u547d\u4ee4<code>sudo systemctl enable ssh<\/code>\u5373\u53ef\u3002\u4f46\u662f\u8fd9\u4e2a\u5bb9\u5668\u4f7f\u7528systemctl\u603b\u662f\u63d0\u793a\u6ca1\u6709\u8fd9\u4e2a\u547d\u4ee4\uff0c\u6240\u4ee5\u8fd8\u8981\u8fdb\u884c\u989d\u5916\u7684\u64cd\u4f5c\uff0c\u628asystemctl\u6210\u529f\u5b89\u88c5\u4e0a\uff0c\u7f51\u4e0a\u5f88\u591a\u4eba\u7684\u5404\u79cd\u65b9\u6cd5\u90fd\u5c1d\u8bd5\u4e86\uff0c\u6ca1\u6709\u6210\u529f\u3002\u6211\u8fd9\u91cc\u7684\u91cd\u65b0\u5b89\u88c5systemctl\u53ef\u4ee5\u5b8c\u7f8e\u7684\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<pre><code>#\u5347\u7ea7\u5b89\u88c5\u5305\napt update\n\n#\u8fdb\u884c\u5b89\u88c5\u5305\u7684\u66f4\u65b0\napt upgrade\n\n#\u5b89\u88c5systemctl\napt install systemctl\n\n#\u8fd9\u65f6\u518d\u8fd0\u884csystemctl\u5c31\u4e0d\u4f1a\u62a5\u9519\u5566\nsystemctl enable ssh<\/code><\/pre>\n<p>systemctl\u7684\u4e00\u4e9b\u64cd\u4f5c\u5982\u4e0b\uff1a<\/p>\n<pre><code>#\u5f00\u673a\u81ea\u542f\u52a8\nsudo systemctl enable ssh\n\n#\u5173\u95edssh\u5f00\u673a\u81ea\u52a8\u542f\u52a8\nsudo systemctl disable ssh\n\n#\u5355\u6b21\u5f00\u542fssh\nsudo systemctl start ssh\n\n#\u5355\u6b21\u5173\u95edssh\nsudo systemctl stop ssh<\/code><\/pre>\n<p>\u8fd9\u65f6\u867d\u7136\u53ef\u4ee5\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8ssh\uff0c\u4f46\u662f\u8c8c\u4f3c\u6ca1\u6709\u751f\u6548\u3002\u6240\u4ee5\u6211\u91c7\u7528\u4e86\u4f7f\u7528\u5f00\u673a\u811a\u672c<code>\/root\/.bashrc<\/code>\u4e0a\uff0c\u589e\u52a0\u4e00\u6761\u542f\u52a8ssh\u7684\u8bb0\u5f55\uff0c\u76f4\u63a5<code>vim \/root\/.bashrc<\/code>\u5373\u53ef\u3002\u6709\u4e24\u79cd\u65b9\u6848\uff0c\u7b2c\u4e00\u79cd\uff1a<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/02\/06\/83.png\" alt=\"img\" \/><\/p>\n<p>\u6b64\u65b9\u6cd5\u662f\u5728bashrc\u7684\u542f\u52a8\u6587\u4ef6\u7684\u672b\u5c3e\uff0c\u589e\u52a0\u4e00\u6761<code>service ssh start<\/code>\u3002\u5f53\u7136\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u4f7f\u7528<code>systemctl start ssh<\/code>\u3002<\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u6848\uff0c\u5728bashrc\u6587\u4ef6\u672b\u5c3e\u589e\u52a0\u4e00\u4e2a\u53ef\u6267\u884c\u7684shell\u811a\u672c\uff0c\u6bd4\u5982\u53ef\u6267\u884c\u7684sh\u811a\u672c\u540d\u79f0\u53ebrebootrun.sh\u3002\u90a3\u4e48\u5728bashrc\u7684\u672b\u5c3e\u589e\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>#reboot run\nif [ -f \/root\/rebootrun.sh ]; then\n      .\/root\/rebootrun.sh\nfi<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\uff0c\u9700\u8981\u5728<code>\/root\/rebootrun.sh<\/code>\u8fd9\u91cc\u6709\u5bf9\u5e94\u7684shell\u53ef\u6267\u884c\u6587\u4ef6\uff0crebootrun.sh\u7684\u5185\u5bb9\u4e3a\uff1a<\/p>\n<pre><code>#!\/bin\/bash\n#\u6253\u5f00ssh\u670d\u52a1\nservice ssh start\n\n#\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\nsystemctl start ssh<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7fa4\u6656NAS\u6559\u7a0b(\u56db)\u3001\u5229\u7528Docker\u5b89\u88c5\u6700\u65b0\u7248Ubuntu-21.04\u5e76\u8fdc\u7a0b\u8bbf\u95ee \u7531\u4e8e\u524d\u9762\u7684\u5199\u7684\u6559\u7a0b\uff0c\u5b89\u88c5\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,10],"tags":[],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-nas","category-nas-docker"],"_links":{"self":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139"}],"version-history":[{"count":1,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":552,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions\/552"}],"wp:attachment":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}