Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Windows Subsystem for Linux 2 と Visual Studio Code Remote (SSH|WSL)

Windows Subsystem for Linux 2 と Visual Studio Code Remote (SSH|WSL)

2020/8/14(Fri) 社内 LT 会で発表した内容です。

typewriter / takuya

August 14, 2020
Tweet

More Decks by typewriter / takuya

Other Decks in Technology

Transcript

  1. Windows S ubsystem for L inux 2 と Visual Studio

    Code Remote (SSH|WSL) 2020/08/14 Takuya Yamaguchi / @no_clock (たいぷらいた~)
  2. たいぷらいた~ @no_clock すき: 京都、百合 京都行きたい… 直近の新刊情報: 8/7 不揃いの連理 (3) 8/12

    おとなになっても (3) 8/21 塔子さんは 家事ができない。 (1) 8/24 ふたりべや (8) 8/27 ゆゆ式 (11) 新米姉妹のふたりごはん (8) ※何を「百合」とするかは個人差があります 正伝寺(京都市北区) 2015/8/27 撮影
  3. Catalina で HDMI 出力が不調… → Ubuntu へ • Mac mini

    を macOS Catalina に更新後、セカンドディスプレイが映らず • Apple Community や各所で同様の報告 • 自作 PC では映る (Windows / Ubuntu)  →よっしゃ Ubuntu 使ったろ! https://discussions.apple.com/thread/250715830 No HDMI signal after update - Apple Community
  4. The Go gopher: Renee French (CC-BY 3.0) TypeScript: Microsoft (CC-BY

    4.0) Windows で Golang や Ruby や TypeScript を書きたい… WSL2 と VSCode Remote (SSH|WSL) が 良いらしいので使ってみるか…?
  5. Windows Subsystem for Linux 開発者は、従来の仮想マシンまたはデュアルブート セットアップのオー バーヘッドなしで、ほとんどのコマンド ライン ツール、ユーティリティ、ア プリケーションを含む

    GNU/Linux 環境を変更せずそのまま Windows 上で直接実行できます。 https://docs.microsoft.com/ja-jp/windows/wsl/about Linux 用 Windows サブシステムについて | Microsoft Docs
  6. Windows Subsystem for Linux 1 “Pico provider drivers (lxss.sys, lxcore.sys)

    that emulate a Linux kernel by translating Linux syscalls” https://www.youtube.com/watch?v=lwhMThePdIo The new Windows subsystem for Linux architecture: a deep dive - BRK3068 - YouTube https://docs.microsoft.com/ja-jp/archive/blogs/wsl/windows-subsystem-for-linux-overview Windows Subsystem for Linux Overview | Microsoft Docs
  7. Windows Subsystem for Linux 2 https://docs.microsoft.com/ja-jp/windows/wsl/compare-versions WSL 2 と WSL

    1 の比較 | Microsoft Docs Feature WSL 1 WSL 2 Integration between Windows and Linux ✅ ✅ Fast boot times ✅ ✅ Small resource foot print ✅ ✅ Runs with current versions of VMWare and VirtualBox ✅ ✅ Managed VM ❌ ✅ Full Linux Kernel ❌ ✅ Full system call compatibility ❌ ✅ Performance across OS file systems ✅ ❌
  8. Windows Subsystem for Linux 2 Integration between Windows and Linux

    • ターミナルを起動 するだけで Linux • Windows 側は /mnt/<drive> で 読み書き可能
  9. Windows Subsystem for Linux 2 Ubuntu 20.04 が そのまま動いている なお

    Ubuntu 20.04 は Microsoft Store から インストールする Microsoft Store の 数少ない活用事例
  10. Terminal conhost.exe (コンソール ウィンドウ ホスト) • コマンドプロンプトや PowerShell 等のガワ •

    操作性はお察し Windows Terminal • 2020/05 バージョン 1.0 リリース • タブ、分割、範囲選択、右クリック貼り付け • 普通に使えるターミナル • Microsoft Store から導入 数少ない活用事例
  11. Visual Studio Code Remote (SSH|WSL) リモートのコードを VSCode で編集できる 拡張機能 ←

    SSH ログインから Go 拡張機能含め いい感じに 動作している様子
  12. Visual Studio Code Remote (SSH|WSL) • リモートに VSCode Server が立っている

    https://code.visualstudio.com/docs/remote/ssh Developing on Remote Machines using SSH and Visual Studio Code
  13. Visual Studio Code Remote (SSH|WSL) • リモートに VSCode Server が立っている

    ◦ Go などの Workspace Extension はリモートで動作 (環境毎にインストールが必要)
  14. The Neovim logo by Jason Long (CC-BY 3.0) 構成 Visual

    Studio Code Windows Terminal VSCode Server Golang tools Docker Neovim
  15. 雑感: 結構いけるぞ…! CUI は…! • WSL2 ◦ 速 (Windows 起動直後で

    5 秒、以降は 1 秒) ◦ VM にあった煩わしさがほぼない ▪ ISO ダウンロード、インストール、起動、停止、 CPU やメモリ割当、性能劣化、ファイル共有… ▪ ただしディスクイメージはある (可変サイズ)
  16. 雑感: 結構いけるぞ…! CUI は…! • WSL2 ◦ GUI は 鋭意対応中

    https://devblogs.microsoft.com/commandline/the-windows-subsystem-for-linux-build-2020-summary/ The Windows Subsystem for Linux BUILD 2020 Summary | Windows Command Line
  17. • WSL 1→2 ◦ Windows Terminal がまともで実用的 ▪ WSL1 の頃、

    conhost.exe がイマイチだが 他にしっくりくるターミナルも見つからず、 sshd 入れて PuTTY (ssh client) を使った時期も… ◦ Docker もばっちり動く Full Linux Kernel 雑感: 結構いけるぞ…! CUI は…!
  18. 雑感: 初期設定さえ済めばいける…! • VSCode Remote (SSH|WSL) ◦ WSL2 との組み合わせは便利 ◦

    Extension をリモートに入れるのは手間 ▪ まずリモートに (go|ruby) をインストールして… ▪ .bash_profile 等は読まないので… VSCode 上の設定でパスを絶対指定したり… ◦ SSH 公開鍵認証では、秘密鍵がパーミッション 600 相当 となるよう NTFS ACL (アクセス制御リスト) の設定が必要
  19. The Go gopher: Renee French (CC-BY 3.0) TypeScript: Microsoft (CC-BY

    4.0) WSL2 と VSCode Remote (SSH|WSL) で 現時点では なんとかなっている! すごい! ( 1 ヶ月ほど運用中)