{"id":8465,"date":"2019-11-06T03:11:51","date_gmt":"2019-11-05T19:11:51","guid":{"rendered":"https:\/\/jpuyy.com\/?p=8465"},"modified":"2022-04-17T22:37:39","modified_gmt":"2022-04-17T14:37:39","slug":"windows-10-wsl-centos-%e9%85%8d%e7%bd%ae%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=8465","title":{"rendered":"windows11 Powershell WSL2 \u914d\u7f6e\u5f00\u53d1\u73af\u5883"},"content":{"rendered":"<p>\u5b89\u88c5 windows terminal<\/p>\n<p>https:\/\/docs.microsoft.com\/zh-cn\/windows\/wsl\/install<\/p>\n<p>\u5b89\u88c5 CentOS ( Microsoft Store )<\/p>\n<p>root \u767b\u5165\uff0c\u5b89\u88c5\u5fc5\u5907\u8f6f\u4ef6\u5305<\/p>\n<pre>\r\nyum update\r\ncat \/etc\/redhat-release\r\nyum install git vim curl\r\n<\/pre>\n<p>WSL \u548c windows \u6587\u4ef6\u4ea4\u6362\u5728 \/mnt \u76ee\u5f55\u4e0b<\/p>\n<pre>\r\nmkidr \/mnt\/c\/Users\/jpuyy\/git\r\nln -s \/mnt\/c\/Users\/jpuyy\/{Downloads,git,OneDrive} ~\/\r\n<\/pre>\n<p>\u4f5c\u4e3a\u9879\u76ee\u76ee\u5f55<\/p>\n<pre>\r\nyum install -y zsh\r\n<\/pre>\n<p>\u5b89\u88c5 oh-my-zsh<\/p>\n<pre>sh -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/ohmyzsh\/ohmyzsh\/master\/tools\/install.sh)\"\r\n<\/pre>\n<p>\u9047\u5230 raw.githubusercontent.com \u88ab\u6c61\u67d3\uff0c\u4e34\u65f6\u89e3\u51b3<\/p>\n<pre>\r\necho 'nameserver 8.8.8.8' > \/etc\/resolv.conf\r\n<\/pre>\n<p>\u5b89\u88c5 kubectx<br \/>\nhttps:\/\/github.com\/ahmetb\/kubectx\/releases<\/p>\n<p>\u5b89\u88c5 winget<br \/>\nhttps:\/\/github.com\/microsoft\/winget-cli\/releases \u4e0b\u8f7d\u4e8c\u8fdb\u5236\u5305<\/p>\n<p>\u5b89\u88c5 keepassxc<br \/>\nwinget install keepassxc<\/p>\n<p>\u91cd\u542f wsl \u865a\u62df\u673a,  \u8fdb\u5165 PowerShell<\/p>\n<pre>\r\n wsl --shutdown\r\n<\/pre>\n<p>\u7136\u540e\u65b0\u5f00\u7a97\u53e3\u542f\u52a8<\/p>\n<p>\u4ece\u539f\u6765\u7684 wsl \u5347\u7ea7\u5230 wsl2<\/p>\n<p>PS C:\\Users\\yangy> wsl -l -v<br \/>\n  NAME      STATE           VERSION<br \/>\n* CentOS    Running         1<\/p>\n<p>wsl &#8211;set-version CentOS 2<br \/>\nPS C:\\Users\\yangy> wsl &#8211;set-version CentOS 2<br \/>\n\u6b63\u5728\u8fdb\u884c\u8f6c\u6362\uff0c\u8fd9\u53ef\u80fd\u9700\u8981\u51e0\u5206\u949f\u65f6\u95f4&#8230;<br \/>\n\u6709\u5173\u4e0e WSL 2 \u7684\u4e3b\u8981\u533a\u522b\u7684\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee https:\/\/aka.ms\/wsl2<br \/>\n\u8bf7\u542f\u7528\u865a\u62df\u673a\u5e73\u53f0 Windows \u529f\u80fd\u5e76\u786e\u4fdd\u5728 BIOS \u4e2d\u542f\u7528\u865a\u62df\u5316\u3002<br \/>\n\u6709\u5173\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee https:\/\/aka.ms\/wsl2-install<\/p>\n<p>## powershell<br \/>\nPS C:\\Users\\yangy>  wsl &#8211;list &#8211;online<br \/>\n\u4ee5\u4e0b\u662f\u53ef\u5b89\u88c5\u7684\u6709\u6548\u5206\u53d1\u7684\u5217\u8868\u3002<br \/>\n\u8bf7\u4f7f\u7528\u201cwsl &#8211;install -d <\u5206\u53d1>\u201d\u5b89\u88c5\u3002<\/p>\n<p>NAME            FRIENDLY NAME<br \/>\nUbuntu          Ubuntu<br \/>\nDebian          Debian GNU\/Linux<br \/>\nkali-linux      Kali Linux Rolling<br \/>\nopenSUSE-42     openSUSE Leap 42<br \/>\nSLES-12         SUSE Linux Enterprise Server v12<br \/>\nUbuntu-16.04    Ubuntu 16.04 LTS<br \/>\nUbuntu-18.04    Ubuntu 18.04 LTS<br \/>\nUbuntu-20.04    Ubuntu 20.04 LTS<\/p>\n<p>winget install oh-my-posh<br \/>\nwinget install aria2<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5 windows terminal https:\/\/docs.microsoft.com\/zh-cn\/windows\/wsl\/install \u5b89\u88c5 CentOS ( Microsoft Store ) root \u767b\u5165\uff0c\u5b89\u88c5\u5fc5\u5907\u8f6f\u4ef6\u5305 yum update cat \/etc\/redhat-release yum install git vim curl WSL \u548c windows \u6587\u4ef6\u4ea4\u6362\u5728 \/mnt \u76ee\u5f55\u4e0b mkidr \/mnt\/c\/Users\/jpuyy\/git ln -s \/mnt\/c\/Users\/jpuyy\/{Downloads,git,OneDrive} ~\/ \u4f5c\u4e3a\u9879\u76ee\u76ee\u5f55 yum install -y zsh \u5b89\u88c5 oh-my-zsh sh -c &#8220;$(curl -fsSL https:\/\/raw.githubusercontent.com\/ohmyzsh\/ohmyzsh\/master\/tools\/install.sh)&#8221; \u9047\u5230 raw.githubusercontent.com \u88ab\u6c61\u67d3\uff0c\u4e34\u65f6\u89e3\u51b3 echo &#8216;nameserver 8.8.8.8&#8217; > \/etc\/resolv.conf \u5b89\u88c5 kubectx [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"class_list":["post-8465","post","type-post","status-publish","format-standard","hentry","category-windows"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/8465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8465"}],"version-history":[{"count":24,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/8465\/revisions"}],"predecessor-version":[{"id":9550,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/8465\/revisions\/9550"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}