{"id":2446,"date":"2021-12-27T10:18:21","date_gmt":"2021-12-27T01:18:21","guid":{"rendered":"https:\/\/mattyan.net\/blog\/?p=2446"},"modified":"2021-12-27T10:18:21","modified_gmt":"2021-12-27T01:18:21","slug":"wsl2%e3%81%aex11%e3%81%a7%e3%83%9d%e3%83%bc%e3%83%88%e3%83%95%e3%82%a9%e3%83%af%e3%83%bc%e3%83%87%e3%82%a3%e3%83%b3%e3%82%b0%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%83%a9%e3%82%ba%e3%83%91%e3%82%a4","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=2446","title":{"rendered":"WSL2\u306eX11\u3067\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u4f7f\u3063\u3066\u30e9\u30ba\u30d1\u30a4\u306eGUI\u3092Windows\u306b\u6301\u3063\u3066\u304d\u3066\u307f\u305f"},"content":{"rendered":"<p>WSL2\u3067X11\u304c\u52d5\u304f\u306e\u3092\u5229\u7528\u3057\u3066\u3001ssh\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u30e9\u30ba\u30d1\u30a4\u306eGUI\u3092Windows\u306b\u6301\u3063\u3066\u304d\u3066\u307f\u305f<\/p>\n<p><!--more--><\/p>\n<h2 id=\"\u306f\u3058\u3081\u306b\">\u306f\u3058\u3081\u306b<\/h2>\n<p>\u524d\u304b\u3089\u4f5c\u3063\u3066\u305f\u30ab\u30e1\u30e9\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u3044\u3058\u308b\u306e\u306bWindows\u306f\u74b0\u5883\u306e\u9055\u3044\u3067\u30ad\u30c4\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u3001\u30e9\u30ba\u30d1\u30a4\u306b\u958b\u767a\u74b0\u5883\u7d44\u3093\u3060\u3002 \u3060\u3051\u3069\u30e9\u30ba\u30d1\u30a4\u306b\u306f\u30e2\u30cb\u30bf\u306f\u4ed8\u3051\u3066\u306a\u3044\u306e\u3067\u305d\u306e\u307e\u307e\u3067\u306f\u4f7f\u3048\u306a\u3044\u3002<\/p>\n<p>RealVNC\u3067\u753b\u9762\u8ee2\u9001\u3057\u3088\u3046\u3068\u3057\u305f\u3051\u3069\u3001\u30b9\u30de\u30db\u7528\u306b\u89e3\u50cf\u5ea6\u7d5e\u3063\u3066\u308b\u306e\u3067\u305d\u306e\u307e\u307e\u3067\u306f\u5c0f\u3055\u304f\u3066\u4f7f\u3044\u306b\u304f\u3044\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001WSL2\u3092\u901a\u305b\u3070Windows\u306b\u753b\u9762\u3092\u8ee2\u9001\u3067\u304d\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3063\u3066\u8a66\u3057\u3066\u307f\u305f\u3002<\/p>\n<h2 id=\"\u30e9\u30ba\u30d1\u30a4\u5074\u306e\u74b0\u5883\u78ba\u8a8d\">\u30e9\u30ba\u30d1\u30a4\u5074\u306e\u74b0\u5883\u78ba\u8a8d<\/h2>\n<p>\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u305f\u3081\u306b\u306fssh\u30b5\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981\u306a\u306e\u3067\u4e00\u65e6\u30e9\u30ba\u30d1\u30a4\u306bssh\u3067\u63a5\u7d9a\u3057\u3066<\/p>\n<pre class=\"sh\"><code class=\"\" data-line=\"\">vim \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u3067\u78ba\u8a8d\u3002 <code class=\"\" data-line=\"\">X11Forwarding yes<\/code>\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u305d\u306e\u307e\u307e\u3067\u3067\u304d\u308b\u3088\u3046\u3060\u3002<\/p>\n<h2 id=\"wsl2\u5074\u306e\u74b0\u5883\u78ba\u8a8d\">WSL2\u5074\u306e\u74b0\u5883\u78ba\u8a8d<\/h2>\n<p>WSL2\u3067X11\u304c\u52d5\u3044\u3066\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306bgedit\u3092\u8d77\u52d5\u3057\u3066\u307f\u308b<\/p>\n<pre><code class=\"\" data-line=\"\">$ gedit\nUnable to init server: Could not connect: Connection refused\n(gedit:29926): Gtk-WARNING **: 09:48:14.906: cannot open display: :0<\/code><\/pre>\n<p>\u3069\u3046\u3082<code class=\"\" data-line=\"\">\/tmp\/.X11-unix<\/code>\u304c\u6b63\u3057\u304f\u306a\u3044\u3089\u3057\u304f\u3001\u3053\u306e\u307e\u307e\u3060\u3068\u753b\u9762\u304c\u51fa\u305b\u306a\u3044\u3002<\/p>\n<pre><code class=\"\" data-line=\"\">$ ls -la \/tmp\ntotal 52\ndrwxrwxrwt 13 root root 4096 Dec 27 09:42 .\ndrwxr-xr-x 19 root root 4096 Dec 27 09:36 ..\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .ICE-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .Test-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .X11-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .XIM-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .font-unix\n$ ls -la \/tmp\/.X11-unix\ntotal 8\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .\ndrwxrwxrwt 13 root root 4096 Dec 27 09:42 ..<\/code><\/pre>\n<p>\u6b63\u76f4\u3044\u3064\u3082\u306e\u3053\u3068\u306a\u306e\u3067\u3001<code class=\"\" data-line=\"\">\/tmp\/.X11-unix<\/code>\u3092<code class=\"\" data-line=\"\">\/mnt\/wslg\/.X11-unix<\/code>\u306e\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u306b\u4fee\u6b63\u3057\u3066X11\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3002<\/p>\n<pre><code class=\"\" data-line=\"\">$ ls -la \/tmp\ntotal 48\ndrwxrwxrwt 12 root root 4096 Dec 27 09:55 .\ndrwxr-xr-x 19 root root 4096 Dec 27 09:36 ..\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .ICE-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .Test-unix\nlrwxrwxrwx  1 root root   19 Dec 27 09:54 .X11-unix -&gt; \/mnt\/wslg\/.X11-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .XIM-unix\ndrwxrwxrwt  2 root root 4096 Dec 27 09:36 .font-unix<\/code><\/pre>\n<p>\u3053\u308c\u3067WSL2\u5074\u306e\u6e96\u5099\u306f\u5b8c\u4e86\u3002<\/p>\n<h2 id=\"\u753b\u9762\u8ee2\u9001\">\u753b\u9762\u8ee2\u9001<\/h2>\n<pre class=\"sh\"><code class=\"\" data-line=\"\">ssh -X pi@192.168.***.***<\/code><\/pre>\n<p>\u203bWSL2\u304b\u3089\u306f\u30e9\u30ba\u30d1\u30a4\u306e\u30db\u30b9\u30c8\u540d\u304c\u898b\u3048\u306a\u304b\u3063\u305f\u306e\u3067\u3001IP\u30a2\u30c9\u30ec\u30b9\u6307\u5b9a\u3067\u63a5\u7d9a\u3002<\/p>\n<p>-X\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u3066X11\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u6709\u52b9\u306b\u3057\u3066WSL2\u74b0\u5883\u304b\u3089ssh\u3067\u63a5\u7d9a\u3002<\/p>\n<p>ssh\u8d8a\u3057\u306bVSCode\u3084\u30ab\u30e1\u30e9\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8d77\u52d5\u3057\u305f\u3089\u3001\u7121\u4e8b\u306b\u753b\u9762\u304cWindows\u306b\u51fa\u305f\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/mattyan.net\/blog\/wp-content\/uploads\/2021\/12\/X11_2.png\" \/><\/p>\n<p>\u305f\u3060\u3001VSCode\u306f\u304b\u306a\u308a\u52d5\u4f5c\u304c\u9045\u3044\u306e\u3067\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306f\u8f9b\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u2026\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WSL2\u3067X11\u304c\u52d5\u304f\u306e\u3092\u5229\u7528\u3057\u3066\u3001ssh\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u30e9\u30ba\u30d1\u30a4\u306eGUI\u3092Windows\u306b\u6301\u3063\u3066\u304d\u3066\u307f\u305f<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2446","post","type-post","status-publish","format-standard","hentry","category-3"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2446"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2446\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}