windows:wsl:install

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン両方とも次のリビジョン
windows:wsl:install [2019/09/13 23:55] – [Windows Subsystem for Linux 2 (WSL 2) を使用するようにディストリビューションを設定] ともやんwindows:wsl:install [2023/03/15 05:46] – [Windows Subsystem for Linux (WSL) Version 2 のインストール (古い資料です)] ともやん
行 1: 行 1:
-<html+~~CLOSETOC~~ 
-  <style+====== Windows Subsystem for Linux (WSL) Version 2 のインストール ====== 
-    #result pre { +{{INLINETOC wide 1-2}} 
-      height200px; +\\ 
-      overflowscroll; + 
-      overflow-xhidden; +===== Windows 10 ビルド番号を確認 ===== 
-    } +PowerShell より Windows 10 ビルド [[https://blogs.windows.com/windowsexperience/2019/06/12/announcing-windows-10-insider-preview-build-18917/|18917]] - 2019/06/12 以降を実行していることを確認する。\\ 
-  </style+<WRAP center round important 100%
-</html+※Windows 10 Insider Preview では Build 18917 から WSL 2 を提供。\\ 
-====== WSL 2 のインストール ======+ Windows 10 一般提供では バージョン 2004 (Build 19041) から WSL 2 を提供。\\ 
 + 参考: [[windows:version_build_info|Windows Version Build 情報]]\\ 
 +</WRAP
 + 
 +<WRAP prewrap 100%> 
 +<code powershell> 
 +$ Get-CimInstance Win32_OperatingSystem | Format-List 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result
 +**Insider Preview の例**\\ 
 +<code powershell> 
 + 
 +SystemDirectory C:\WINDOWS\system32 
 +Organization    
 +BuildNumber     : 20206 
 +RegisteredUser  : tomoyan 
 +SerialNumber    : 00330-80000-00000-AA721 
 +Version         : 10.0.20206 
 +</code> 
 + 
 +**一般提供の例**\\ 
 +<code powershell> 
 + 
 +SystemDirectory : C:\WINDOWS\system32 
 +Organization    : 
 +BuildNumber     : 19042 
 +RegisteredUser  : tomoyan 
 +SerialNumber    : 00330-80000-00000-AA162 
 +Version         : 10.0.19042 
 +</code
 +</WRAP> 
 +WSL を提供していない Windows 10 を実行している場合は、[スタート] - [設定] - [更新とセキュリティ] - [Windows Update] の順に選択し、[更新プログラムのチェック] を実行する。\\ 
 + 
 +**PowerShell** で **wsl** コマンドを実行する。\\ 
 +<WRAP prewrap 100%> 
 +<code powershell> 
 +$ wsl 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell> 
 + 
 +Copyright (c) Microsoft Corporation. All rights reserved. 
 + 
 +使用方法: wsl.exe [Argument] 
 + 
 +引数: 
 + 
 +    --install 
 +        Linux 用 Windows サブシステムのオプション機能を有効にします。 
 +        このコマンドは、管理者特権でのコマンド プロンプトから実行する必要があります。 
 + 
 +    --help 
 +        使用方法の情報を表示します。 
 +</code> 
 +</WRAP> 
 + 
 +===== インストール ===== 
 +**wsl --install** コマンドを管理者で実行していない場合は、以下のような実行結果になる。\\ 
 +<WRAP prewrap 100%> 
 +<code> 
 +$ wsl --install 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell> 
 +要求された操作には管理者特権が必要です。 
 +</code> 
 +</WRAP> 
 + 
 +管理者実行している **PowerShell** で **wsl --install** コマンドを実行する。\\ 
 +もしくは、[[windows:sudo|]] で管理者実行する。\\ 
 +<WRAP prewrap 100%> 
 +<code> 
 +$ sudo wsl --install 
 +</code> 
 +</WRAP> 
 + 
 +<WRAP prewrap 100% #result> 
 +<code powershell> 
 +Installing Windows Subsystem for Linux 
 +[==========================74.8%============               ] 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell> 
 +Windows Subsystem for Linux is now installed. 
 +Downloading and installing WSL kernel 
 +[============              21.4%                           ] 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell> 
 +Installing Windows Subsystem for Linux 
 +Windows Subsystem for Linux is now installed. 
 +Downloading and installing WSL kernel 
 +WSL kernel is now installed. 
 +要求された操作は正常に終了しました。変更を有効にするには、システムを再起動する必要があります。</code> 
 +</WRAP> 
 + 
 +変更を有効にするために Windows を再起動する。\\ 
 + 
 +===== 再起動後に wsl コマンドを実行 ===== 
 +WSL のインストールが完了すると **wsl** コマンドの説明が以下のように変わる。\\ 
 +<WRAP prewrap 100%> 
 +<code> 
 +$ wsl --help 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result_long> 
 +**Insider Preview の例**\\ 
 +<code powershell> 
 +Copyright (c) Microsoft Corporation. All rights reserved. 
 + 
 +使用法: wsl.exe [Argument] [Options...] [CommandLine] 
 + 
 +Linux バイナリを実行するための引数: 
 + 
 +    コマンド ラインを指定しないと、wsl.exe は既定のシェルを起動します。 
 + 
 +    --exec, -e <CommandLine> 
 +        指定したコマンドを、既定の Linux シェルを使用しないで実行します。 
 + 
 +    -- 
 +        残りのコマンド ラインをそのまま渡します。 
 + 
 +オプション: 
 +    --distribution, -d <ディストリビューション> 
 +        指定したディストリビューションを実行します。 
 + 
 +    --user, -u <UserName> 
 +        指定したユーザーとして実行します。 
 + 
 +Linux 用 Windows サブシステムを管理するための引数: 
 + 
 +    --export <ディストリビューション> <FileName> 
 +        ディストリビューションを tar ファイルにエクスポートします。 
 +        標準出力の場合は、ファイル名を - とすることができます。 
 + 
 +    --import <ディストリビューション> <InstallLocation> <FileName> [Options] 
 +        指定した tar ファイルを新しいディストリビューションとしてインポートします。 
 +        標準入力の場合は、ファイル名を - とすることができます。 
 + 
 +        オプション: 
 +            --version <バージョン> 
 +                新しいディストリビューションに使用するバージョンを指定します。 
 + 
 +    --list, -l [Options] 
 +        ディストリビューションの一覧を表示します。 
 + 
 +        オプション: 
 +            --all 
 +                現在インストール中またはアンインストール中のものを含めて 
 +                すべてのディストリビューションを一覧表示します。 
 + 
 +            --running 
 +                現在実行中のディストリビューションのみを一覧表示します。 
 + 
 +            --quiet, -q 
 +                ディストリビューション名のみを表示します。 
 + 
 +            --verbose, -v 
 +                すべてのディストリビューションについての詳細情報を表示します。 
 + 
 +    --set-default, -s <ディストリビューション> 
 +        ディストリビューションを既定として設定します。 
 + 
 +    --set-default-version <バージョン> 
 +        新しいディストリビューションの既定のインストール バージョンを変更します。 
 + 
 +    --set-version <ディストリビューション> <バージョン> 
 +        指定したディストリビューションのバージョンを変更します。 
 + 
 +    --shutdown 
 +        実行中のすべてのディストリビューションと WSL 2 ライトウェイト ユーティリティ仮想マシンを直ちに終了します。 
 + 
 +    --terminate, -t <ディストリビューション> 
 +        指定したディストリビューションを終了します。 
 + 
 +    --unregister <ディストリビューション> 
 +        ディストリビューション登録を解除し、ルート ファル システムを削除します。 
 + 
 +    --help 
 +        使用法を表示します。 
 + 
 +    --update [Options] 
 +        WSL 2 カーネルに対する更新を管理します。オプショが指定されていない場合は、 
 +        最新バージョンのカーネルに更新します。 
 + 
 +        オプション: 
 +            --rollback 
 +                以前のバージョンの WSL 2 カーネルに戻します。 
 + 
 +            --status 
 +                更新の状態を表示します。 
 +</code> 
 + 
 +**一般提供の例**\\ 
 +<code powershell> 
 +Copyright (c) Microsoft Corporation. All rights reserved. 
 + 
 +使用法: wsl.exe [引数] [オプション...] [コマンド ライン] 
 + 
 +Linux バイナリを実行するための引数: 
 + 
 +    コマンド ラインを指定しないと、wsl.exe は既定のシェルを起動します。 
 + 
 +    --exec, -e <コマンド ライン> 
 +        指定したコマンドを、既定の Linux シェルを使用しないで実行します。 
 + 
 +    -- 
 +        残りのコマンド ラインをそのまま渡します。 
 + 
 +オプション: 
 +    --distribution, -d <ディストリビュション> 
 +        指定したディストリビューションを実行します。 
 + 
 +    --user, -u <ユーザー名> 
 +        指定したユーザーとして実行します。 
 + 
 +Linux 用 Windows サブシステムを管理するための引数: 
 + 
 +    --export <ディストリビューション> <ファイ名> 
 +        ディストリビューションを tar ファイルにエクスポートします。 
 +        標準出力の場合は、ファイル名を - とすることができます。 
 + 
 +    --import <ディストリビューション> <インストール場所> <ファイル名> [オプション] 
 +        指定した tar ファイルを新しいディストリビューションとしてインポートします。 
 +        標準入力の場合は、ファイル名を - とすることができます。 
 + 
 +        オプション: 
 +            --version <バージョン> 
 +                新しいディストリビューションに使用するバージョンを指定します。 
 + 
 +    --list, -l [オプション] 
 +        ディストリビューションの一覧を表示します。 
 + 
 +        オプション: 
 +            --all 
 +                現在インストール中またはアンインストール中のものを含めて 
 +                すべてのディストリビューションを一覧表示します。 
 + 
 +            --running 
 +                現在実行中のディストリビューションのみを一覧表示します。 
 + 
 +            --quiet, -q 
 +                ディストリビューション名のみを表示します。 
 + 
 +            --verbose, -v 
 +                すべてのディストリビューションについての詳細情報を表示します。 
 + 
 +    --set-default, -s <ディストリビューション> 
 +        ディストリビューションを既定として設定します。 
 + 
 +    --set-default-version <バージョン> 
 +        新しいディストリビューションの既定のインストール バージョンを変更します。 
 + 
 +    --set-version <ディストリビューション> <バージョン> 
 +        指定したディストリビューションのバージョンを変更します。 
 + 
 +    --shutdown 
 +        実行中のすべてのディストリビューションと WSL 2 ライトウェイト ユーティリティ仮想マシンを直ちに終了します。 
 + 
 +    --terminate, -t <ディストリビューション> 
 +        指定したディストリビューションを終了します。 
 + 
 +    --unregister <ディストリビューション> 
 +        ディストリビューションの登録を解除します。 
 + 
 +    --help 
 +        使用法を表示します。 
 +</code> 
 +Insider Preview と表示内容が若干異なるが支障はない。\\ 
 +</WRAP> 
 + 
 +====== ☢️古い資料です☢️ ====== 
 + 
 +===== Windows Subsystem for Linux (WSL) Version 2 のインストール ===== 
 +**__注意: [[.:lxrunoffline|LxRunOffline - システムドライブ外に WSL 環境を構築する方法]] で公式の Fedora を WSL で利用できる。__**\\ 
 + 
 +本手順では、WSL 2 上に [[https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL|Fedora Rimix for WSL]] ディストリビューションをインストールする。\\ 
 +Fedora ファンとしては、Fedora Remix for WSL が Fedora 公式ではないのがちょっと残念ではあるが、使い慣れた Fedora が Windows 10 でも使えるのはありがたい。\\ 
 +\\ 
 +現在 [[https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL|Fedora Remix for WSL]] は [[https://www.pengwin.dev/|Whitewater Foundry]] が [[https://getfedora.org/ja/|Fedora Project]] 非公式でメンテしている。\\ 
 +実は、[[https://github.com/WhitewaterFoundry/WSLFedoraRemix/releases|GitHub]] を介して無料でサイドロードできる Fedora Remix for WSL の署名済みダウンロードも提供している。\\ 
 +無償で利用したい場合は試してみるとよいだろう。\\ 
 +\\
 ※ 2019/09/13 現在 Build 18917 以降は **[[windows:windows_10_insider_previews|Windows 10 Insider Previews]]** としてのみ公開されている。\\ ※ 2019/09/13 現在 Build 18917 以降は **[[windows:windows_10_insider_previews|Windows 10 Insider Previews]]** としてのみ公開されている。\\
 以下の手順は Build 18362 ~ 18980 へ更新しながら検証した。\\ 以下の手順は Build 18362 ~ 18980 へ更新しながら検証した。\\
  
 ===== Windows 10 ビルド番号を確認 ===== ===== Windows 10 ビルド番号を確認 =====
-コマンドプロンプトより Windows 10 ビルド 18917 以降を実行していることを確認する。\\ +PowerShell より Windows 10 ビルド [[https://blogs.windows.com/windowsexperience/2019/06/12/announcing-windows-10-insider-preview-build-18917/|18917]] - 2019/06/12 以降を実行していることを確認する。\\ 
-<code batch+<WRAP center round important 100%
-ver+※Windows 10 Insider Preview では Build 18917 から WSL 2 を提供。\\ 
 + Windows 10 一般提供では バージョン 2004 (Build 19041) から WSL 2 を提供。\\ 
 +</WRAP> 
 +<code powershell> 
 +$ Get-CimInstance Win32_OperatingSystem | Format-List
  
-Microsoft Windows [Version 10.0.18362.356]+SystemDirectory : C:\WINDOWS\system32 
 +Organization    : 
 +BuildNumber     : 18362 
 +RegisteredUser  : tomoyan 
 +SerialNumber    : 00330-80000-00000-AA721 
 +Version         : 10.0.18362
 </code> </code>
 [スタート] - [設定] - [更新とセキュリティ] - [Windows Update] の順に選択し、[更新プログラムのチェック] を実行する。\\ [スタート] - [設定] - [更新とセキュリティ] - [Windows Update] の順に選択し、[更新プログラムのチェック] を実行する。\\
  
-<code batch+<code powershell
-> ver+$ Get-CimInstance Win32_OperatingSystem | Format-List
  
-Microsoft Windows [Version 10.0.18980.1]+SystemDirectory : C:\WINDOWS\system32 
 +Organization    : 
 +BuildNumber     : 18980 
 +RegisteredUser  : tomoyan 
 +SerialNumber    : 00330-80000-00000-AA721 
 +Version         : 10.0.18980
 </code> </code>
  
 ===== Hyper-V の有効化 ===== ===== Hyper-V の有効化 =====
 PowerShell を管理者実行する。\\ PowerShell を管理者実行する。\\
 +<WRAP prewrap 100%>
 <code batch> <code batch>
 > powershell start-process powershell -verb runas > powershell start-process powershell -verb runas
 </code> </code>
 +</WRAP>
  
 管理者実行した PowerShell で Hyper-V が有効になっていることを確認する。\\ 管理者実行した PowerShell で Hyper-V が有効になっていることを確認する。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ bcdedit /enum | find `"hypervisorlaunchtype`"
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > bcdedit /enum | find `"hypervisorlaunchtype`" 
 hypervisorlaunchtype    Auto hypervisorlaunchtype    Auto
 </code> </code>
 +</WRAP>
  
 Hyper-V が Off の場合は On にする。\\ Hyper-V が Off の場合は On にする。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ bcdedit /enum | find `"hypervisorlaunchtype`"
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > bcdedit /enum | find `"hypervisorlaunchtype`" 
 hypervisorlaunchtype    Off hypervisorlaunchtype    Off
 </code> </code>
 +</WRAP>
 +
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ bcdedit /set hypervisorlaunchtype auto
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > bcdedit /set hypervisorlaunchtype auto 
 この操作を正しく終了しました。 この操作を正しく終了しました。
 </code> </code>
 +</WRAP>
  
 Hyper-V を有効化した場合は PC を一旦再起動する。\\ Hyper-V を有効化した場合は PC を一旦再起動する。\\
 +<WRAP prewrap 100%>
 <code powershell> <code powershell>
-PS > shutdown /r /t 0+shutdown /r /t 0
 </code> </code>
 +</WRAP>
  
 ===== 仮想マシン プラットフォームの有効化 ===== ===== 仮想マシン プラットフォームの有効化 =====
 再起動した場合は再び PowerShell を管理者として実行する。\\ 再起動した場合は再び PowerShell を管理者として実行する。\\
 **"仮想マシン プラットフォーム"** のオプション コンポーネントを有効にする。\\ **"仮想マシン プラットフォーム"** のオプション コンポーネントを有効にする。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform 
- 
 Path          : Path          :
 Online        : True Online        : True
 RestartNeeded : False RestartNeeded : False
 </code> </code>
 +</WRAP>
  
 **"仮想マシン プラットフォーム"** を有効化したら再び PC を再起動する。\\ **"仮想マシン プラットフォーム"** を有効化したら再び PC を再起動する。\\
 +<WRAP prewrap 100%>
 <code powershell> <code powershell>
-PS > shutdown /r /t 0+shutdown /r /t 0
 </code> </code>
 +</WRAP>
  
 ===== Windows Subsystem for Linux (WSL) のインストール ===== ===== Windows Subsystem for Linux (WSL) のインストール =====
 再起動した場合は再び PowerShell を管理者として実行する。\\ 再起動した場合は再び PowerShell を管理者として実行する。\\
 Windows Subsystem for Linux をインストールする。\\ Windows Subsystem for Linux をインストールする。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 
 この操作を完了するために、今すぐコンピューターを再起動しますか? この操作を完了するために、今すぐコンピューターを再起動しますか?
 [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): <- Enter キーを入力 [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): <- Enter キーを入力
 </code> </code>
 +</WRAP>
  
 ===== Linux ディストリビューションのインストール ===== ===== Linux ディストリビューションのインストール =====
行 87: 行 424:
  
 ダウンロードが完了したら [スタート] - [Fedora Rimix for WSL] を起動してみる。\\ ダウンロードが完了したら [スタート] - [Fedora Rimix for WSL] を起動してみる。\\
 +<WRAP prewrap 100% #result>
 <code> <code>
 Unpacking Linux filesystem image, this may take a few minutes... Unpacking Linux filesystem image, this may take a few minutes...
行 94: 行 432:
 Press any key to continue... Press any key to continue...
 </code> </code>
 +</WRAP>
 化けているが... 本当はこういうエラーらしい。\\ 化けているが... 本当はこういうエラーらしい。\\
 +<WRAP prewrap 100% #result>
 <code> <code>
 Unpacking Linux filesystem image, this may take a few minutes... Unpacking Linux filesystem image, this may take a few minutes...
行 101: 行 441:
 Press any key to continue... Press any key to continue...
 </code> </code>
 +</WRAP>
  
 Windows Subsystem for Linux を一旦無効化する。\\ Windows Subsystem for Linux を一旦無効化する。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 
 この操作を完了するために、今すぐコンピューターを再起動しますか? この操作を完了するために、今すぐコンピューターを再起動しますか?
 [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): <- Enter キーを入力 [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): <- Enter キーを入力
 </code> </code>
 +</WRAP>
  
 再起動したら再び PowerShell を管理者として実行する。\\ 再起動したら再び PowerShell を管理者として実行する。\\
 Windows Subsystem for Linux を再度有効化して再起動する。\\ Windows Subsystem for Linux を再度有効化して再起動する。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 
 この操作を完了するために、今すぐコンピューターを再起動しますか? この操作を完了するために、今すぐコンピューターを再起動しますか?
 [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): <- Enter キーを入力 [Y] Yes  [N] No  [?] ヘルプ (既定値は "Y"): <- Enter キーを入力
 </code> </code>
 +</WRAP>
  
 再起動が完了したら [スタート] - [Fedora Rimix for WSL] を起動する。\\ 再起動が完了したら [スタート] - [Fedora Rimix for WSL] を起動する。\\
 すると今度はきちんと以下のような状態になる。\\ すると今度はきちんと以下のような状態になる。\\
 +<WRAP prewrap 100% #result>
 <code> <code>
 Unpacking Linux filesystem image, this may take a few minutes... Unpacking Linux filesystem image, this may take a few minutes...
行 125: 行 479:
 Enter new UNIX username: Enter new UNIX username:
 </code> </code>
 +</WRAP>
  
 最初にデフォルト Linux ユーザーの作成を行う。\\ 最初にデフォルト Linux ユーザーの作成を行う。\\
 +<WRAP prewrap 100% #result>
 <code> <code>
 Welcome to Fedora Remix for WSL. Powered by Pengwin Enterprise. Welcome to Fedora Remix for WSL. Powered by Pengwin Enterprise.
行 138: 行 494:
 [tomoyan@Cmon ~]$ exit [tomoyan@Cmon ~]$ exit
 </code> </code>
 +</WRAP>
  
 ===== Windows Subsystem for Linux 2 (WSL 2) を使用するようにディストリビューションを設定 =====  ===== Windows Subsystem for Linux 2 (WSL 2) を使用するようにディストリビューションを設定 ===== 
 再び PowerShell を管理者として実行する。\\ 再び PowerShell を管理者として実行する。\\
 **wsl -l -v** を実行して **Fedora Remix** が初期化済みであることを確認する。\\ **wsl -l -v** を実行して **Fedora Remix** が初期化済みであることを確認する。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ wsl -l -v
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 <code powershell> <code powershell>
-PS > wsl -l -v 
   NAME           STATE           VERSION   NAME           STATE           VERSION
 * fedoraremix    Stopped         1 * fedoraremix    Stopped         1
 </code> </code>
 +</WRAP>
  
 **念のため再度確認!!(重要)**\\ **念のため再度確認!!(重要)**\\
 **wsl** コマンドに **--verbose, -v**、**--set-version** オプションが無い場合は Windows 10 ビルド 18917 以降を実行していないので Windows を更新する。\\ **wsl** コマンドに **--verbose, -v**、**--set-version** オプションが無い場合は Windows 10 ビルド 18917 以降を実行していないので Windows を更新する。\\
 +<WRAP center round important 100%>
 +※Windows 10 Insider Preview では Build 18917 から WSL 2 を提供。\\
 + Windows 10 一般提供では バージョン 2004 (Build 19041) から WSL 2 を提供。\\
 +</WRAP>
 **--verbose, -v**、**--set-version** オプションが無い例。\\ **--verbose, -v**、**--set-version** オプションが無い例。\\
-<WRAP prewrap 100% #result>+<WRAP prewrap 100%> 
 +<code powershell> 
 +$ wsl --help 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result_long>
 <code powershell> <code powershell>
-PS > wsl --help 
 Copyright (c) Microsoft Corporation. All rights reserved. Copyright (c) Microsoft Corporation. All rights reserved.
  
行 214: 行 585:
  
 **--verbose, -v**、**--set-version** オプションが有る例。\\ **--verbose, -v**、**--set-version** オプションが有る例。\\
-<WRAP prewrap 100% #result>+<WRAP prewrap 100%>
 <code powershell> <code powershell>
-PS > wsl --help+wsl --help 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result_long> 
 +<code powershel>
 Copyright (c) Microsoft Corporation. All rights reserved. Copyright (c) Microsoft Corporation. All rights reserved.
  
行 294: 行 669:
 **wsl --set-version <Distro> 2** を実行する。\\ **wsl --set-version <Distro> 2** を実行する。\\
 ※ここでは <Distro> は **fedoraremix** である。\\ ※ここでは <Distro> は **fedoraremix** である。\\
-<code+<WRAP prewrap 100%
-PS > wsl --set-version fedoraremix 2+<code powershell> 
 +wsl --set-version fedoraremix 2 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell>
 変換中です。この処理には数分かかることがあります... 変換中です。この処理には数分かかることがあります...
 WSL 2 との主な違いについては、https://aka.ms/wsl2 を参照してください WSL 2 との主な違いについては、https://aka.ms/wsl2 を参照してください
 変換が完了しました。 変換が完了しました。
 </code> </code>
 +</WRAP>
  
 ===== 今後インストールする新しいディストリビューションが WSL 2 を既定のアーキテクチャとするように設定 ===== ===== 今後インストールする新しいディストリビューションが WSL 2 を既定のアーキテクチャとするように設定 =====
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ wsl --set-default-version 2
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 +<code powershell>
 +WSL 2 との主な違いについては、https://aka.ms/wsl2 を参照してください
 +</code>
 +</WRAP>
 +
 +===== 現在のディストリビューションが使用している WSL のバージョンを確認 =====
 +**wsl -l -v** を実行して、現在のディストリビューションが使用している WSL のバージョンを確認する。\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ wsl -l -v
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 +<code powershell>
 +  NAME           STATE           VERSION
 +* fedoraremix    Stopped         2
 +</code>
 +</WRAP>
 +
 +以上で WSL 2 を使用する準備が整いました。\\
 +
 +===== bash の起動確認 =====
 +この状態でいつでも WSL 2 の環境にアクセスできる。\\
 +bash の起動は 1 秒も掛からなかった。非常に高速である。\\
 +<WRAP prewrap 100% #result_long>
 <code> <code>
-PS > wsl --set-default-version 2+PS > bash 
 + 
 +$ uname -
 +Linux Cmon 4.19.67-microsoft-standard #1 SMP Sun Aug 18 13:37:54 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 
 + 
 +$ cat /etc/redhat-release 
 +Generic release 30 (Generic) 
 + 
 +$ cd / 
 +$ ls -al 
 +total 684 
 +drwxr-xr-x 19 root root   4096 Sep 14 00:01 . 
 +drwxr-xr-x 19 root root   4096 Sep 14 00:01 .. 
 +lrwxrwxrwx  1 root root      7 Feb 11  2019 bin -> usr/bin 
 +dr-xr-xr-x  root root   4096 Feb 11  2019 boot 
 +drwx------  3 root root   4096 Jun 16 23:09 builddir 
 +drwxr-xr-x  7 root root   2740 Sep 14 00:01 dev 
 +drwxr-xr-x 55 root root   4096 Sep 14 00:01 etc 
 +drwxr-xr-x  3 root root   4096 Sep 13 18:53 home 
 +-rwxr-xr-x  2 root root 623984 Sep  8 23:26 init 
 +lrwxrwxrwx  1 root root      7 Feb 11  2019 lib -> usr/lib 
 +lrwxrwxrwx  1 root root      9 Feb 11  2019 lib64 -> usr/lib64 
 +drwx------  2 root root  16384 Apr 11 01:35 lost+found 
 +drwxr-xr-x  2 root root   4096 Feb 11  2019 media 
 +drwxr-xr-x  3 root root   4096 Sep 13 18:45 mnt 
 +drwxr-xr-x  2 root root   4096 Feb 11  2019 opt 
 +dr-xr-xr-x 87 root root      0 Sep 14 00:01 proc 
 +dr-xr-x---  2 root root   4096 Jun 16 23:10 root 
 +drwxr-xr-x  8 root root    160 Sep 14 00:01 run 
 +lrwxrwxrwx  1 root root      8 Feb 11  2019 sbin -> usr/sbin 
 +drwxr-xr-x  2 root root   4096 Feb 11  2019 srv 
 +dr-xr-xr-x 11 root root      0 Sep 13 23:50 sys 
 +drwxrwxrwt  3 root root   4096 Feb 11  2019 tmp 
 +drwxr-xr-x 12 root root   4096 Jun 16 23:09 usr 
 +drwxr-xr-x 18 root root   4096 Jun 16 23:09 var
 </code> </code>
 +</WRAP>
  
 +===== ディストリビューション パッケージの更新 =====
 +Fedora Rimix for WSL は Fedora 30 相当のようである。\\
 +**sudo dnf update** を実行してパッケージを更新する。\\
 +<WRAP prewrap 100% #result_long>
 +<code>
 +$ sudo dnf update
 +Fedora Modular 30 - x86_64                              708 kB/s | 2.7 MB     00:03
 +Fedora Modular 30 - x86_64 - Updates                    678 kB/s | 3.3 MB     00:04
 +Fedora 30 - x86_64 - Updates                            1.6 MB/s |  20 MB     00:12
 +Fedora 30 - x86_64                                      558 kB/s |  70 MB     02:08
 +whitewaterfoundry_wslu                                  228  B/s | 833  B     00:03
 +whitewaterfoundry_wslu                                  2.8 kB/s | 3.9 kB     00:01
 +Importing GPG key 0x10735619:
 + Userid     : "https://packagecloud.io/whitewaterfoundry/wslu (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
 + Fingerprint: 90F6 8549 4B52 C0E9 6DA4 B925 0087 4F17 1073 5619
 + From       : https://packagecloud.io/whitewaterfoundry/wslu/gpgkey
 +Is this ok [y/N]: y
 +whitewaterfoundry_wslu                                  342  B/s | 1.8 kB     00:05
 +Dependencies resolved.
 +===================================================================================
 + Package                     Arch   Version                         Repo      Size
 +===================================================================================
 +Upgrading:
 + NetworkManager              x86_64 1:1.16.4-1.fc30                 updates  1.8 M
 + NetworkManager-libnm        x86_64 1:1.16.4-1.fc30                 updates  1.5 M
 + audit                       x86_64 3.0-0.9.20190507gitf58ec40.fc30 updates  229 k
 + audit-libs                  x86_64 3.0-0.9.20190507gitf58ec40.fc30 updates  106 k
 + bind-export-libs            x86_64 32:9.11.10-1.fc30               updates  1.0 M
 + cryptsetup-libs             x86_64 2.2.0-1.fc30                    updates  404 k
 + cups-libs                   x86_64 1:2.2.12-1.fc30                 updates  252 k
 + curl                        x86_64 7.65.3-3.fc30                   updates  297 k
 + dbus                        x86_64 1:1.12.16-1.fc30                updates   11 k
 + dbus-common                 noarch 1:1.12.16-1.fc30                updates   18 k
 + dbus-libs                   x86_64 1:1.12.16-1.fc30                updates  147 k
 + dhcp-client                 x86_64 12:4.3.6-37.fc30                updates  227 k
 + dhcp-common                 noarch 12:4.3.6-37.fc30                updates  125 k
 + dhcp-libs                   x86_64 12:4.3.6-37.fc30                updates   63 k
 + dnf                         noarch 4.2.8-1.fc30                    updates  405 k
 + dnf-data                    noarch 4.2.8-1.fc30                    updates   45 k
 + dnf-plugins-core            noarch 4.0.9-1.fc30                    updates   28 k
 + dnf-yum                     noarch 4.2.8-1.fc30                    updates   42 k
 + elfutils                    x86_64 0.177-1.fc30                    updates  300 k
 + elfutils-default-yama-scope noarch 0.177-1.fc30                    updates   16 k
 + elfutils-libelf             x86_64 0.177-1.fc30                    updates  177 k
 + elfutils-libs               x86_64 0.177-1.fc30                    updates  264 k
 + expat                       x86_64 2.2.7-1.fc30                    updates   92 k
 + fedora-gpg-keys             noarch 30-2                            updates  104 k
 + fedora-repos                noarch 30-2                            updates  9.5 k
 + file                        x86_64 5.36-4.fc30                     updates   48 k
 + file-libs                   x86_64 5.36-4.fc30                     updates  544 k
 + gdb-headless                x86_64 8.3-6.fc30                      updates  3.4 M
 + glib2                       x86_64 2.60.7-1.fc30                   updates  2.6 M
 + glibc                       x86_64 2.29-22.fc30                    updates  4.0 M
 + glibc-common                x86_64 2.29-22.fc30                    updates  838 k
 + glibc-langpack-en           x86_64 2.29-22.fc30                    updates  818 k
 + glibc-minimal-langpack      x86_64 2.29-22.fc30                    updates   47 k
 + gnupg2                      x86_64 2.2.17-1.fc30                   updates  2.4 M
 + graphite2                   x86_64 1.3.13-1.fc30                   updates   95 k
 + iproute                     x86_64 5.2.0-1.fc30                    updates  572 k
 + iptables-libs               x86_64 1.8.2-3.fc30                    updates   49 k
 + kmod-libs                   x86_64 26-3.fc30                       updates   58 k
 + less                        x86_64 551-1.fc30                      updates  144 k
 + libXi                       x86_64 1.7.10-1.fc30                   updates   36 k
 + libblkid                    x86_64 2.33.2-2.fc30                   updates  144 k
 + libcurl                     x86_64 7.65.3-3.fc30                   updates  251 k
 + libdnf                      x86_64 0.35.2-1.fc30                   updates  574 k
 + libfdisk                    x86_64 2.33.2-2.fc30                   updates  193 k
 + libgcc                      x86_64 9.2.1-1.fc30                    updates   91 k
 + libgcrypt                   x86_64 1.8.5-1.fc30                    updates  450 k
 + libgomp                     x86_64 9.2.1-1.fc30                    updates  220 k
 + libgs                       x86_64 9.26-5.fc30                     updates  3.0 M
 + libmodulemd1                x86_64 1.8.15-3.fc30.1                 updates  161 k
 + libmount                    x86_64 2.33.2-2.fc30                   updates  167 k
 + libnghttp2                  x86_64 1.39.2-1.fc30                   updates   69 k
 + librepo                     x86_64 1.10.5-1.fc30                   updates   88 k
 + libreport-filesystem        noarch 2.10.1-1.fc30                   updates   13 k
 + librsvg2                    x86_64 2.45.90-1.fc30                  updates  2.1 M
 + libselinux                  x86_64 2.9-3.1.fc30                    updates   78 k
 + libsmartcols                x86_64 2.33.2-2.fc30                   updates  107 k
 + libsolv                     x86_64 0.7.5-1.fc30                    updates  378 k
 + libssh                      x86_64 0.9.0-5.fc30                    updates  226 k
 + libstdc++                   x86_64 9.2.1-1.fc30                    updates  578 k
 + libtiff                     x86_64 4.0.10-5.fc30                   updates  167 k
 + libuuid                     x86_64 2.33.2-2.fc30                   updates   26 k
 + libwebp                     x86_64 1.0.3-1.fc30                    updates  255 k
 + libxcrypt                   x86_64 4.4.8-1.fc30                    updates  122 k
 + libzstd                     x86_64 1.4.2-1.fc30                    updates  257 k
 + lz4-libs                    x86_64 1.9.1-1.fc30                    updates   62 k
 + openssh                     x86_64 8.0p1-5.fc30                    updates  405 k
 + openssh-clients             x86_64 8.0p1-5.fc30                    updates  555 k
 + openssh-server              x86_64 8.0p1-5.fc30                    updates  394 k
 + openssl-libs                x86_64 1:1.1.1c-6.fc30                 updates  1.4 M
 + pango                       x86_64 1.43.0-4.fc30                   updates  260 k
 + patch                       x86_64 2.7.6-11.fc30                   updates  126 k
 + pcre2                       x86_64 10.33-13.fc30                   updates  248 k
 + python-pip-wheel            noarch 19.0.3-3.fc30                   updates  1.1 M
 + python3                     x86_64 3.7.4-1.fc30                    updates   36 k
 + python3-dnf                 noarch 4.2.8-1.fc30                    updates  413 k
 + python3-dnf-plugins-core    noarch 4.0.9-1.fc30                    updates  160 k
 + python3-hawkey              x86_64 0.35.2-1.fc30                   updates   87 k
 + python3-libdnf              x86_64 0.35.2-1.fc30                   updates  671 k
 + python3-libs                x86_64 3.7.4-1.fc30                    updates  7.7 M
 + python3-rpm                 x86_64 4.14.2.1-5.fc30                 updates   65 k
 + qt5-srpm-macros             noarch 5.12.4-1.fc30                   updates  8.9 k
 + redhat-rpm-config           noarch 130-1.fc30                      updates   63 k
 + rpm                         x86_64 4.14.2.1-5.fc30                 updates  479 k
 + rpm-build                   x86_64 4.14.2.1-5.fc30                 updates  106 k
 + rpm-build-libs              x86_64 4.14.2.1-5.fc30                 updates   86 k
 + rpm-libs                    x86_64 4.14.2.1-5.fc30                 updates  264 k
 + rpm-sign-libs               x86_64 4.14.2.1-5.fc30                 updates   23 k
 + rust-srpm-macros            noarch 10-1.fc30                       updates  9.5 k
 + shared-mime-info            x86_64 1.13.1-1.fc30                   updates  316 k
 + sqlite-libs                 x86_64 3.26.0-6.fc30                   updates  537 k
 + systemd                     x86_64 241-12.git1e19bcd.fc30          updates  3.8 M
 + systemd-libs                x86_64 241-12.git1e19bcd.fc30          updates  504 k
 + systemd-pam                 x86_64 241-12.git1e19bcd.fc30          updates  157 k
 + systemd-rpm-macros          noarch 241-12.git1e19bcd.fc30          updates   22 k
 + tzdata                      noarch 2019b-1.fc30                    updates  425 k
 + util-linux                  x86_64 2.33.2-2.fc30                   updates  2.4 M
 + vim-minimal                 x86_64 2:8.1.1912-1.fc30               updates  592 k
 + zlib                        x86_64 1.2.11-18.fc30                  updates   91 k
 + zstd                        x86_64 1.4.2-1.fc30                    updates  371 k
 + wslu                        noarch 2.3.1-1                         whitewaterfoundry_wslu
 +                                                                             249 k
 +Installing dependencies:
 + libevent                    x86_64 2.1.8-7.fc30                    updates  231 k
 + libssh-config               noarch 0.9.0-5.fc30                    updates   11 k
 + linux-atm-libs              x86_64 2.5.1-25.fc30                   updates   35 k
 + openssl                     x86_64 1:1.1.1c-6.fc30                 updates  634 k
 + whois-nls                   noarch 5.5.1-1.fc30                    updates   33 k
 + xkeyboard-config            noarch 2.26-2.fc30                     updates  837 k
 + libsecret                   x86_64 0.18.8-1.fc30                   fedora   152 k
 + unbound-libs                x86_64 1.8.3-4.fc30                    fedora   465 k
 +Installing weak dependencies:
 + gnupg2-smime                x86_64 2.2.17-1.fc30                   updates  251 k
 + iproute-tc                  x86_64 5.2.0-1.fc30                    updates  389 k
 + libxcrypt-compat            x86_64 4.4.8-1.fc30                    updates   96 k
 + mkpasswd                    x86_64 5.5.1-1.fc30                    updates   39 k
 + python3-pip                 noarch 19.0.3-3.fc30                   updates  1.8 M
 + rpm-plugin-systemd-inhibit  x86_64 4.14.2.1-5.fc30                 updates   19 k
 + deltarpm                    x86_64 3.6-29.fc30                     fedora    77 k
 + libxkbcommon                x86_64 0.8.3-1.fc30                    fedora   108 k
 + openssl-pkcs11              x86_64 0.4.10-1.fc30                   fedora    60 k
 + pinentry                    x86_64 1.1.0-5.fc30                    fedora    90 k
 + python3-dbus                x86_64 1.2.8-5.fc30                    fedora   127 k
 + python3-setuptools          noarch 40.8.0-1.fc30                   fedora   636 k
 + python3-unbound             x86_64 1.8.3-4.fc30                    fedora    96 k
 +
 +Transaction Summary
 +===================================================================================
 +Install   21 Packages
 +Upgrade  100 Packages
 +
 +Total download size: 63 M
 +Is this ok [y/N]: y
 +
 +~省略~
 +
 +  xkeyboard-config-2.26-2.fc30.noarch
 +  libsecret-0.18.8-1.fc30.x86_64
 +  unbound-libs-1.8.3-4.fc30.x86_64
 +
 +Complete!
 +</code>
 +</WRAP>
  
  • windows/wsl/install.txt
  • 最終更新: 2023/03/15 05:53
  • by ともやん