0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WSL2でたまにGUIをつかうには

Posted at

やりたいこと

(1)主にwin10(GUI)を使う。
(2)従でWSL2(CUI)を使うが、たまにGUIアプリを表示したい。
(3)サクサク動くことが最優先。無駄なGUI化はしない。

解決策

(1)Win10にvcxsrvをインストールする。
(2)必要な時だけ、Win10でxsrvを起動する。
(3)WSL2(CUI)がGUIを求めれば、vcxsrvに画像を飛ばす。

vcxsrvのインストーラをダウンロード

下のサイトから(約40MB)
https://sourceforge.net/projects/vcxsrv/

Windowsにインストール

vcxsrv-64.x.x.x.x.installer.exeを管理者権限で実行
defenderの確認が出たら許可(パブリック、任意のリモートポート)

WSL2に環境変数を設定
WSL2
[root@wsl ~]# cat /etc/resolv.conf | grep nameserver
nameserver 172.xx.xx.1
[root@wsl ~]# export DISPLAY=172.xx.xx.1:0.0
動作テスト
WSL2
[root@wsl ~]# xeyes

表示される
xeyes.png

おしまい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?