待ちに待った Windows10 のバージョン 2004 が提供開始されましたので早速クリーンインストールを敢行しました。
今日仕事が休みで本当に良かったです。
下準備(は、ほぼしてない)
特に何も調べずに WSL2 を使うための準備を始めました。
Windows Terminal 自体はバージョン 1903 で利用可能になった時点で愛用していたので、これはクリーンインストール後にすぐに入れました。
WSL2 の準備
検索したら Microsoft Docs が出てきたので、それをそのまま実施しました。
まずはカーネルの更新とやらをダウンロードしてインストール。
WSL 2 Linux カーネルの更新
その後、インストールガイドに従ってセットアップ。
Windows 10 用 Windows Subsystem for Linux のインストール ガイド
Microsoft Store から Ubuntu をインストール
こちらを使いました。
https://www.microsoft.com/store/productId/9NBLGGH4MSV6
先ほどのインストールガイド通りにセットアップしてみると、以下のようになりました。
ユーザー名は landwarrior で、自分の PC のコンピュータ名が rayleonard です。
カッコいいでしょ?笑
WSL2 に変換
デフォルトをバージョン 2 にするように書いてあったのですが、最初のインストール時はバージョンが 1 みたいです。
インストールガイド通り、 PowerShell で以下のコマンドを実行すると VERSION
の部分が 1 になってました。
wsl --list --verbose
なので念のためもう一度以下のコマンドを実施。
wsl --set-default-version 2
でもって、変換します。
wsl --set-version Ubuntu 2
何やらメッセージが出て、最終的に以下のようになります。
手探りでやってたのでだいぶ端折ってますが許してください。。。
Windows Terminal で見てみる
Ubuntu をインストールすると、勝手に Windows Terminal のコンフィグで設定が増えるみたいです。
元々設定をいじっていましたが、最終的に以下のようにしています。
// This file was initially generated by Windows Terminal 1.0.1401.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"fontFace": "hackgen",
"fontSize": 16,
"acrylicOpacity": 0.8,
"useAcrylic": true,
"colorScheme" : "Campbell"
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "コマンド プロンプト",
"commandline": "cmd.exe",
"hidden": false,
"fontFace": "hackgen",
"fontSize": 16,
"acrylicOpacity": 0.8,
"useAcrylic": true,
"colorScheme" : "Campbell"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl",
"fontFace": "hackgen",
"fontSize": 16,
"acrylicOpacity": 0.8,
"useAcrylic": true,
"colorScheme" : "Campbell"
}
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [
{
"name" : "Campbell",
"background" : "#0C0C0C",
"black" : "#0C0C0C",
"blue" : "#0037DA",
"foreground" : "#77ffad",
"green" : "#13A10E",
"red" : "#C50F1F",
"white" : "#CCCCCC",
"yellow" : "#C19C00"
}
],
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
起動してみるとこんな感じに。
マウントされているんですね。
元々 WSL 自体を触ったことがないので、全然分かっていませんが・・・
wsl
コマンドをある程度覚えておいた方がよさそうに感じたのと、複数立ち上げる方法が現時点では分かっていないのですが、それはまた今度調べることにして・・・
とりあえず動いたので、おっけー👌
気が向いたら WSL2 についてもうちょい調べてみようと思います。
余談
WSL を使うにあたって、 VirtualBox などの他のホスト型仮想環境は使えなくなるものと思っていました。
基盤になっているのが Hyper-V で、これとその他のホスト型仮想環境は同居できないんじゃなかったでしたっけ?
普通にできているのですが・・・
今度 Vagrant も入れて試してみますかね。
ではではこの辺でアディオス~🎈