{"id":3726,"date":"2023-02-06T12:32:03","date_gmt":"2023-02-06T04:32:03","guid":{"rendered":"http:\/\/www.chenlianfu.com\/?p=3726"},"modified":"2023-02-07T10:52:45","modified_gmt":"2023-02-07T02:52:45","slug":"%e5%ae%89%e8%a3%85windows%e5%ad%90%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"http:\/\/www.chenlianfu.com\/?p=3726","title":{"rendered":"\u5b89\u88c5Windows\u5b50\u7cfb\u7edf"},"content":{"rendered":"\n<h2>1. \u5728Windows10\u6216Windows11\u7cfb\u7edf\u4e2d<a href=\"https:\/\/learn.microsoft.com\/zh-cn\/windows\/wsl\/install\" target=\"_blank\" rel=\"noreferrer noopener\">\u5b89\u88c5WSL<\/a> (Windows Subsystem for Linux)<\/h2>\n\n\n\n<p>\u6309windows+q\u952e\uff0c\u5728\u6253\u5f00\u7684\u641c\u7d22\u680f\u4e2d\u8f93\u5165\u201c\u529f\u80fd\u201d\uff0c\u70b9\u51fb\u51fa\u73b0\u7684\u201c\u542f\u7528\u6216\u5173\u95edWindows\u529f\u80fd\u201d\uff0c\u5728\u51fa\u73b0\u7684\u590d\u9009\u6846\u62c6\u5355\u4e2d\u4e2d\uff0c\u52fe\u9009\u201c\u9002\u7528\u4e8eLinux\u7684Windows\u5b50\u7cfb\u7edf\u201d\u548c\u201c\u865a\u62df\u673a\u5e73\u53f0\u201d\u3002\u7136\u540e\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u7528\u4e8e\u5b89\u88c5WSL\uff0c\u5b8c\u6bd5\u540e\u63d0\u793a\u91cd\u542f\u8ba1\u7b97\u673a\uff0c\u6309\u63d0\u793a\u786e\u8ba4\u91cd\u542f\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u6216\u4f7f\u7528Windows\u81ea\u5e26\u7684\u547d\u4ee4\u884c\u7ec8\u7aef\u8fdb\u884c\u64cd\u4f5c\uff1a\u6309windows+x\u952e\uff0c\u518d\u6309\u5b57\u6bcda\uff0c\u5219\u6253\u5f00\u7ba1\u7406\u5458PowerShell\uff1b\u8f93\u5165\u547d\u4ee4\u201cwsl &#8211;install\u201d\uff0c\u7136\u540e\u91cd\u542f\u8ba1\u7b97\u673a\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u76ee\u524d\uff0cWSL\u67091\u548c2\u4e24\u4e2a\u7248\u672c\uff0c\u9ed8\u8ba4\u5b89\u88c5\u7684\u662fWSL2\u3002WSL2\u76f8\u6bd4WSL1\uff0c\u5b83\u591a\u4e863\u4e2a\u529f\u80fd\uff1a\u6258\u7ba1VM\uff0c\u5b8c\u6574\u7684Linux\u5185\u6838\u548c\u5b8c\u5168\u7684\u7cfb\u7edf\u8c03\u7528\u517c\u5bb9\u6027\uff0c\u4f46\u5176\u8de8OS\u6587\u4ef6\u7cfb\u7edf\u7684\u6027\u80fd\u8f83\u5dee\u3002\u5728\u7ba1\u7406\u5458PowerShell\u4e2d\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u53ef\u4ee5\u5207\u6362WSL\u7248\u672c\uff1a\u201cwsl &#8211;set-default-version 1\u201d\u3002<\/p>\n\n\n\n<h2>2. <a href=\"https:\/\/learn.microsoft.com\/zh-cn\/windows\/wsl\/install-manual\" target=\"_blank\" rel=\"noreferrer noopener\">\u5b89\u88c5Linux\u5b50\u7cfb\u7edf<\/a><\/h2>\n\n\n\n<p>\u5728Windows\u7cfb\u7edf\u7684\u5fae\u8f6f\u5e94\u7528\u5546\u5e97\u4e2d\u641c\u7d22Linux\u5b50\u7cfb\u7edf\uff0c\u9009\u62e9\u4e00\u4e2a\u8fdb\u884c\u4e0b\u8f7d\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u6216\u8005\u6253\u5f00Windows\u7ba1\u7406\u5458Power Shell\uff0c\u4f7f\u7528\u547d\u4ee4\u201cwsl &#8211;list &#8211;online\u201d\u68c0\u6d4b\u53ef\u4ee5\u4f7f\u7528\u7684Linux\u5b50\u7cfb\u7edf\uff0c\u5f53\u524d\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">NAME FRIENDLY NAME<br>Ubuntu Ubuntu<br>Debian Debian GNU\/Linux<br>kali-linux Kali Linux Rolling<br>SLES-12 SUSE Linux Enterprise Server v12<br>SLES-15 SUSE Linux Enterprise Server v15<br>Ubuntu-18.04 Ubuntu 18.04 LTS<br>Ubuntu-20.04 Ubuntu 20.04 LTS<br>Ubuntu-22.04 Ubuntu 22.04 LTS<br>OracleLinux_8_5 Oracle Linux 8.5<br>OracleLinux_7_9 Oracle Linux 7.9<\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u4e0b\u8f7d\u76f8\u5e94\u7684Linux\u7cfb\u7edf\uff0c\u4f8b\u5982\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165https:\/\/aka.ms\/wslubuntu2204\u7f51\u5740\uff0c\u5373\u53ef\u4e0b\u8f7d\u5f97\u5230\u6587\u4ef6Ubuntu2204-221101.AppxBundle\u3002\u4e0b\u8f7d\u5b8c\u6bd5\u540e\uff0c\u53cc\u51fb\u5b89\u88c5\u5373\u53ef\u3002\u9700\u8981\u6ce8\u610f\uff0c\u53ef\u80fd\u53cc\u51fb\u5b89\u88c5\u4e0d\u6210\u529f\uff0c\u6b64\u65f6\u9700\u8981\u6839\u636e\u63d0\u793a\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00https:\/\/aka.ms\/wslstore\u7f51\u5740\uff0c\u5e76\u4e0b\u8f7d<a rel=\"noreferrer noopener\" href=\"https:\/\/wslstorestorage.blob.core.windows.net\/wslblob\/wsl_update_x64.msi\" target=\"_blank\">WSL2 Linux\u5185\u6838\u66f4\u65b0\u5305<\/a>\u5e76\u5b89\u88c5\uff0c\u7136\u540e\u518d\u5b89\u88c5Ubuntu2204\u3002\u5b89\u88c5\u5b8c\u6bd5\u540e\u6839\u636e\u63d0\u793a\u8bbe\u7f6e\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n\n\n\n<h2>3. \u4f7f\u7528Linux\u5b50\u7cfb\u7edf<\/h2>\n\n\n\n<p>\u6253\u5f00Windows Power Shell\uff0c\u4f7f\u7528\u547d\u4ee4bash\u6216ubuntu\u5373\u53ef\u8fdb\u5165\u5230Linux\u5b50\u7cfb\u7edf\u3002\u6211\u5b89\u88c5\u4e86cygwin\u865a\u62df\u673a\uff0c\u5728cygwin\u4e2d\u8f93\u5165ubuntu\u547d\u4ee4\u4e5f\u80fd\u8fdb\u5165\u5230Linux\u5b50\u7cfb\u7edf\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/zh-cn\/windows\/wsl\/wsl-config\" data-type=\"URL\" data-id=\"https:\/\/learn.microsoft.com\/zh-cn\/windows\/wsl\/wsl-config\" target=\"_blank\" rel=\"noreferrer noopener\">\u5728Linux\u5b50\u7cfb\u7edf\u4e2d\u521b\u5efa\/etc\/wsl.conf\uff0c\u80fd\u5bf9Linux\u5b50\u7cfb\u7edf\u8fdb\u884c\u4e00\u4e9b\u8bbe\u7f6e<\/a>\uff0c\u4f8b\u5982\uff1a\u662f\u5426\u81ea\u52a8\u6302\u8f7dWindows\u7cfb\u7edf\u7684\u78c1\u76d8\u5206\u533a\u3001\u8bbe\u7f6e\u4e3b\u673a\u540d\u3001\u662f\u5426\u5c06Windows\u7a0b\u5e8f\u6dfb\u52a0\u5230PATH\u73af\u5883\u53d8\u91cf\u3002\u7b80\u5355\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[network]<br>hostname=ubuntu2204<\/pre>\n\n\n\n<p>\u91cd\u542fLinux\u5b50\u7cfb\u7edf\u65b9\u6cd5\uff1a\uff081\uff09\u5728Linux\u5b50\u7cfb\u7edf\u6216Windows Power Shell\u4e2d\uff0c\u8f93\u5165\u547d\u4ee4\u201cwsl.exe &#8211;shutdown\u201d\u5373\u53ef\uff1b\uff082\uff09\u5728 Windows Power Shell\u4e2d\uff0c\u8f93\u5165\u547d\u4ee4\u201cnet stop LxssManager\u201d\u5173\u95ed\u76f8\u5e94\u670d\u52a1\uff0c\u5728\u8f93\u5165\u547d\u4ee4\u201cnet stop LxssManager\u201d\u5f00\u542f\u670d\u52a1\u3002<\/p>\n\n\n\n<p>\u82e5\u8bbe\u7f6e\u7528\u6237\u65e0\u5bc6\u7801sudo\u65f6\uff0c\u9700\u8981\u4fee\u6539\/etc\/sudoers\u6587\u4ef6\u5185\u5bb9\u201c%sudo ALL=(ALL:ALL) NOPASSWD:ALL\u201d\uff0c\u800c\u4ec5\u5355\u72ec\u5bf9\u7528\u6237\u8fdb\u884cNOPASSWD\u8bbe\u7f6e\u4f9d\u7136\u4e0d\u80fd\u751f\u6548\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528Linux\u5b50\u7cfb\u7edf\u524d\uff0c\u63a8\u8350\u5148\u5b89\u88c5\u4e00\u4e9b\u8f6f\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\nsudo apt-get install gcc sra-toolkit net-tools sysstat<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u5728Windows10\u6216Windows11\u7cfb\u7edf\u4e2d\u5b89\u88c5WSL (Windows &hellip; <a href=\"http:\/\/www.chenlianfu.com\/?p=3726\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3726"}],"collection":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3726"}],"version-history":[{"count":12,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3726\/revisions"}],"predecessor-version":[{"id":3742,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3726\/revisions\/3742"}],"wp:attachment":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3726"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}