{"id":210,"date":"2020-06-04T16:07:58","date_gmt":"2020-06-04T07:07:58","guid":{"rendered":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=210"},"modified":"2021-02-12T12:53:45","modified_gmt":"2021-02-12T03:53:45","slug":"wsl%e3%82%92wsl2%e3%81%ab%e6%9b%b4%e6%96%b0%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=210","title":{"rendered":"WSL\u3092WSL2\u306b\u66f4\u65b0\u3057\u3066\u307f\u305f"},"content":{"rendered":"\n<p>Windows 10 2004\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3001WSL2\u304c\u5229\u7528\u53ef\u80fd\u306b\u306a\u3063\u305f\u306e\u3067\u3001WSL\u306eUbuntu Linux\u3092WSL2\u306b\u5909\u66f4\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u3001<a href=\"https:\/\/docs.microsoft.com\/ja-jp\/windows\/wsl\/wsl2-kernel\">\u3053\u306e\u30da\u30fc\u30b8<\/a>\u306e\u30ea\u30f3\u30af\u304b\u3089\u3001wsl_update_x64.msi\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5b9f\u884c\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u5f8c\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u7b49\u3067\u3001wsl\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001WSL\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5909\u66f4\u3059\u308b\u3002<br>\u307e\u305a\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u73fe\u5728\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u898b\u3066\u307f\u3088\u3046\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plane\" data-file=\"\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u78ba\u8a8d\"><code>C:\\&gt;wsl -l -v\n  NAME                  STATE           VERSION\n* openSUSE-Leap-15-1    Running         1\n  Ubuntu                Running         1<\/code><\/pre><\/div>\n\n\n\n<p>\u6b21\u306b\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u30922\u306b\u5909\u66f4\u3057\u305f\u3044\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3057\u3066\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002\u4eca\u56de\u306fUbuntu\u3092\u30d0\u30fc\u30b8\u30e7\u30f32\u306b\u3057\u3066\u307f\u308b\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plane\" data-file=\"WSL2\u306b\u5909\u63db\"><code>C:\\&gt;wsl --set-version Ubuntu 2<\/code><\/pre><\/div>\n\n\n\n<p>\u5b9f\u884c\u304c\u7d42\u308f\u308b\u3068\u3001\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u306fWSL2\u3067\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<p>WSL2\u306b\u5909\u63db\u5f8c\u3001\u4f7f\u7528\u3057\u3066\u307f\u3066\u3001\u3061\u3087\u3063\u3068\u56f0\u3063\u305f\u70b9\u304c\u3044\u304f\u3064\u304b\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u3001WSL2\u306fVM\u3068\u3057\u3066\u52d5\u4f5c\u3059\u308b\u306e\u3067\u3001\u4eca\u307e\u3067\u306f\u3001Windows\u3068\u540c\u3058IP\u3067\u52d5\u4f5c\u3057\u3066\u3044\u305f\u3082\u306e\u304c\u3001\u5225IP\u3068\u306a\u308b\u70b9\u3002(\u4eee\u60f3\u30a2\u30c0\u30d7\u30bf\u304c\u4f5c\u6210\u3055\u308c\u3001Windows\u5074\u3068WSL\u5074\u306b\u5225IP\u304c\u632f\u3089\u308c\u308b)<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u3001WSL\u4e0a\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3068Windows\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u30dd\u30fc\u30c8\u304c\u30d0\u30c3\u30c6\u30a3\u30f3\u30b0\u3057\u306a\u304f\u306a\u308b\u306e\u3067\u60aa\u3044\u70b9\u3070\u304b\u308a\u3067\u306f\u306a\u3044\u304c\u3001\u4f8b\u3048\u3070\u3001WSL\u4e0a\u3067asp.dotnet core\u306e\u30a2\u30d7\u30ea\u3092dotnet run\u7b49\u3067\u52d5\u304b\u3057\u3066Windows\u5074\u304b\u3089\u30d6\u30e9\u30a6\u30b6\u3067\u30c6\u30b9\u30c8\u3057\u3088\u3046\u3068\u3057\u305f\u5834\u5408\u3001launchsettings.json\u306eIP\u3092\u76f4\u3055\u306a\u3044\u3068\u3001Windows\u5074\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u3044\u3002<br>(\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fhttps:\/\/localhost:5001;http:\/\/localhost:5000\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3002)<\/p>\n\n\n\n<p>\u5f8c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u8a2d\u5b9a\u3067\u306f\u540d\u524d\u89e3\u6c7a\u304c\u51fa\u6765\u306a\u3044\u5834\u5408\u304c\u3042\u308b\u3002\u3053\u308c\u306f\u3001\/etc\/resolv.conf\u306e\u5185\u5bb9\u304c\u30af\u30e9\u30a4\u30a2\u30f3\u30c8(Windows)\u306e\u4eee\u60f3IP\u30a2\u30c9\u30ec\u30b9\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001Windows\u5074\u306b\u540d\u524d\u89e3\u6c7a\u6a5f\u80fd\u304c\u306a\u3044\u3068\u3001\u30db\u30b9\u30c8\u540d\u7b49\u304c\u89e3\u6c7a\u3055\u308c\u305a\u3001dotnet new\u7b49\u3082\u5931\u6557\u3059\u308b\u3002<br>(nuget.org\u304c\u89e3\u6c7a\u3067\u304d\u306a\u3044\u305f\u3081)<\/p>\n\n\n\n<p>\u305d\u3046\u3044\u3046\u5834\u5408\u306f\u3001\/etc\/resolv.conf\u306e\u5185\u5bb9\u3092\u30af\u30e9\u30a4\u30a2\u30f3\u30c8(Windows)\u306eDNS\u30b5\u30fc\u30d0\u8a2d\u5b9a\u306b\u5408\u308f\u305b\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<br>\u79c1\u306e\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a2\u30c9\u30ec\u30b9\u304c\u632f\u3089\u308c\u3066\u3044\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plane\" data-file=\"Windows\u5074\"><code>\u30a4\u30fc\u30b5\u30cd\u30c3\u30c8 \u30a2\u30c0\u30d7\u30bf\u30fc vEthernet (WSL):\n\n   \u63a5\u7d9a\u56fa\u6709\u306e DNS \u30b5\u30d5\u30a3\u30c3\u30af\u30b9 . . . . .:\n   \u30ea\u30f3\u30af\u30ed\u30fc\u30ab\u30eb IPv6 \u30a2\u30c9\u30ec\u30b9. . . . .: fe80::bdb1:e7a4:4e3:46c4%45\n   IPv4 \u30a2\u30c9\u30ec\u30b9 . . . . . . . . . . . .: 172.23.240.1\n   \u30b5\u30d6\u30cd\u30c3\u30c8 \u30de\u30b9\u30af . . . . . . . . . .: 255.255.240.0\n   \u30c7\u30d5\u30a9\u30eb\u30c8 \u30b2\u30fc\u30c8\u30a6\u30a7\u30a4 . . . . . . .:<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plane\" data-file=\"WSL\u5074\"><code>eth0      Link encap:Ethernet  HWaddr 00:15:5d:5d:24:31\n          inet addr:172.23.251.65  Bcast:172.23.255.255  Mask:255.255.240.0\n          inet6 addr: fe80::215:5dff:fe5d:2431\/64 Scope:Link\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\n          RX packets:12294 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:2691 errors:0 dropped:0 overruns:0 carrier:0\n          collisions:0 txqueuelen:1000\n          RX bytes:15734461 (15.7 MB)  TX bytes:6991441 (6.9 MB)<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-plane\" data-file=\"\/etc\/resolv.conf\"><code># This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to \/e\ntc\/wsl.conf:\n# [network]\n# generateResolvConf = false\nnameserver 172.23.240.1 # \u2190Windows\u5074\u306eIP\u30a2\u30c9\u30ec\u30b9\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b<\/code><\/pre><\/div>\n\n\n\n<p>\u901f\u5ea6\u306b\u95a2\u3057\u3066\u306fVM\u306b\u306a\u3063\u305f\u3053\u3068\u3067\u3001\u52d5\u4f5c\u304c\u9045\u304f\u306a\u308b\u304b\u3068\u5fc3\u914d\u3057\u305f\u304c\u3001\u666e\u901a\u306b\u4f7f\u3046\u5206\u306b\u306f\u554f\u984c\u306a\u3055\u305d\u3046\u3060\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001\u8907\u6570\u306e\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u3092WSL2\u306b\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u5168\u3066\u540c\u3058VM\u3092\u5171\u6709\u3057\u3066\u3044\u308b\u3088\u3046\u3060\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows 10 2004\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3001WSL2\u304c\u5229\u7528\u53ef\u80fd\u306b\u306a\u3063\u305f\u306e\u3067\u3001W &hellip; <a href=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=210\">\u7d9a\u304d\u3092\u8aad\u3080 <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":{"footnotes":""},"categories":[6,4],"tags":[],"class_list":["post-210","post","type-post","status-publish","format-standard","hentry","category-windows","category-4"],"_links":{"self":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210"}],"version-history":[{"count":5,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/210\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}