Skip to content

Instantly share code, notes, and snippets.

@kght6123
Last active April 24, 2022 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kght6123/895fa8e8518aa9ebf03af10d3cae1c3c to your computer and use it in GitHub Desktop.
Save kght6123/895fa8e8518aa9ebf03af10d3cae1c3c to your computer and use it in GitHub Desktop.
WSL2 Node.js +winget+ Remote WSL 開発環境構築メモ

自分用の備忘録です

WSL2を入れる

たしか公式 https://docs.microsoft.com/ja-jp/windows/wsl/install を見ながらやった気がする

> wsl --list --all
Linux 用 Windows サブシステム ディストリビューション:
Ubuntu (既定)

wingetをいれる

無い場合はストアからインストールする https://www.microsoft.com/ja-jp/p/app-installer/9nblggh4nns1?rtc=1&activetab=pivot:overviewtab

> winget install -e --id Microsoft.VisualStudioCode.Insiders
> winget install -e --id Microsoft.WindowsTerminal

ほかのパッケージはここから探す https://winget.run/

gitとnode.js(LTS:最新の偶数Version)を入れる

$ sudo apt-get update
$ sudo apt-get install git
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo apt-get install gcc g++ make
$ npm -v
8.5.0
$ node -v
v16.14.2

SF Monoを入れる

$ sudo apt install p7zip-full
$ sudo apt install fontconfig
$ mkdir ./sf_mono
$ cd !$
$ wget https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg
$ 7z x SF-Mono.dmg
$ cd SFMonoFonts
$ 7z x SF\ Mono\ Fonts.pkg
$ 7z x Payload~
$ sudo mkdir /usr/share/fonts/SFMono
$ sudo cp Library/Fonts/* /usr/share/fonts/SFMono
$ fc-cache -fv
$ fc-list | grep SFMono

C:\Users\kght6\sf_mono\SFMonoFonts\Library\FontsをWindowsで開いて、ついでにWindowsにもインストールしておく → フォントをすべて選択→右クリック→その他オプションを表示→インストール

VSCodeから開く

  1. 拡張機能のRemote WSLをインスト
  2. 左下の><を押す
  3. New WSL Windowを選ぶ
  4. WSL2に接続したVSCodeが開く

ターミナルにSF Monoを適用する

タブの▽を押す→設定→プロファイル→規定値→外観→フォントフェイス→SF Monoにする

DockerをWSL2に入れる

https://zenn.dev/sprout2000/articles/95b125e3359694

参考文献

https://ryonakagami.github.io/2021/12/07/ubuntu-SFMono-Font-Setting/

時間があったら、過去ブログの再検証をしたい

https://kght6123.page/posts/WSL/Docker%20Desktop%EF%BC%88WSL2%EF%BC%89%E3%81%AB%E3%80%81VSCode%E3%81%AERemote%20WSL%E3%81%A7%E7%B9%8B%E3%81%92%E3%81%AA%E3%81%8B%E3%81%A3%E3%81%9F%EF%BC%81/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment