Linux 用 Windows サブシステム ディストリビューション パッケージを手動でダウンロードするManually download Windows Subsystem for Linux distro packages
Microsoft Store 経由で WSL Linux ディストリビューションをインストールすることができない (または必要ない) シナリオがいくつかあります。There are several scenarios in which you may not be able (or want) to, install WSL Linux distros via the Microsoft Store. 具体的には、Microsoft Store をサポートしていない Windows サーバーまたは長期的なサービス (LTSC) デスクトップ OS SKU を実行している場合や、企業ネットワーク ポリシーや管理者が環境で Microsoft Store の使用を許可していない場合があります。Specifically, you may be running a Windows Server or Long-Term Servicing (LTSC) desktop OS SKU that doesn't support Microsoft Store, or your corporate network policies and/or admins to not permit Microsoft Store usage in your environment.
このような場合、WSL 自体は使用できても、ストアにアクセスできない場合に、WSL に Linux ディストリビューションをダウンロードしてインストールするにはどうすればよいでしょうか。In these cases, while WSL itself is available, how do you download and install Linux distros in WSL if you can't access the store?
注: Cmd、PowerShell、Linux および WSL ディストリビューションなどのコマンドライン シェル環境は、Windows 10 S モード上の実行が許可されていません。Note: Command-line shell environments including Cmd, PowerShell, and Linux/WSL distros are not permitted to run on Windows 10 S Mode. この制限は、S モードで提供される整合性と安全性の目標を確保するために存在します。詳細については、この投稿を参照してください。This restriction exists in order to ensure the integrity and safety goals that S Mode delivers: Read this post for more information.
ディストリビューションのダウンロードDownloading distributions
Microsoft Store アプリを使用できない場合は、以下のリンクをクリックして Linux ディストリビューションをダウンロードして手動でインストールできます。If the Microsoft Store app is not available, you can download and manually install Linux distros by clicking these links:
- Ubuntu 20.04Ubuntu 20.04
- Ubuntu 20.04 ARMUbuntu 20.04 ARM
- Ubuntu 18.04Ubuntu 18.04
- Ubuntu 18.04 ARMUbuntu 18.04 ARM
- Ubuntu 16.04Ubuntu 16.04
- Debian GNU/LinuxDebian GNU/Linux
- Kali LinuxKali Linux
- OpenSUSE Leap 42OpenSUSE Leap 42
- SUSE Linux Enterprise Server 12SUSE Linux Enterprise Server 12
- WSL のための Fedora リミックスFedora Remix for WSL
これにより、選択したフォルダーに <distro>.appx
パッケージがダウンロードされます。This will cause the <distro>.appx
packages to download to a folder of your choosing. インストール手順に従って、ダウンロードしたディストリビューションをインストールします。Follow the installation instructions to install your downloaded distro(s).
コマンド ラインからのディストリビューションのダウンロードDownloading distros via the command line
必要に応じて、コマンド ラインから好みのディストリビューションをダウンロードすることもできます。If you prefer, you can also download your preferred distro(s) via the command line:
PowerShell を使用してダウンロードするDownload using PowerShell
PowerShell を使用してディストリビューションをダウンロードするには、Invoke-WebRequest コマンドレットを使用します。To download distros using PowerShell, use the Invoke-WebRequest cmdlet. Ubuntu 16.04 をダウンロードする手順の例を次に示します。Here's a sample instruction to download Ubuntu 16.04.
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing
ヒント
ダウンロードに時間がかかる場合は、$ProgressPreference = 'SilentlyContinue'
を設定して進行状況バーをオフにしますIf the download is taking a long time, turn off the progress bar by setting $ProgressPreference = 'SilentlyContinue'
curl を使用してダウンロードするDownload using curl
Windows 10 Spring 2018 Update (またはそれ以降) には、コマンド ラインから Web 要求 (HTTP GET、POST、PUT などのコマンド) を呼び出すことができる一般的な curl コマンドライン ユーティリティが含まれています。Windows 10 Spring 2018 Update (or later) includes the popular curl command-line utility with which you can invoke web requests (i.e. HTTP GET, POST, PUT, etc. commands) from the command line. curl.exe
を使用して、上記のディストリビューションをダウンロードできます。You can use curl.exe
to download the above distros:
curl.exe -L -o ubuntu-1604.appx https://aka.ms/wsl-ubuntu-1604
上記の例では、(curl
だけでなく) curl.exe
が実行され、PowerShell では、Invoke-WebRequest の PowerShell curl エイリアスではなく、実際の curl 実行可能ファイルが呼び出されます。In the above example, curl.exe
is executed (not just curl
) to ensure that, in PowerShell, the real curl executable is invoked, not the PowerShell curl alias for Invoke-WebRequest
注: Cmd シェルや
.bat
/.cmd
スクリプトを使用してダウンロード手順を呼び出したりスクリプトで実行したりする必要がある場合は、curl
を使用することをお勧めします。Note: Usingcurl
might be preferable if you have to invoke/script download steps using Cmd shell and/or.bat
/.cmd
scripts.
ディストリビューションのインストールInstalling your distro
Windows 10 を使用している場合、PowerShell を使用してディストリビューションをインストールできます。If you're using Windows 10 you can install your distro with PowerShell. 上記の手順でダウンロードしたディストリビューションを含むフォルダーに移動して、そのディレクトリで次のコマンドを実行します。この app_name
は、ディストリビューションの .appx ファイルの名前です。Simply navigate to folder containing the distro downloaded from above, and in that directory run the following command where app_name
is the name of your distro .appx file.
Add-AppxPackage .\app_name.appx
Windows サーバーを使用している場合、または上記のコマンドを実行しているときに問題が発生した場合は、Windows Server のドキュメント ページにある代替のインストール手順を参照して、.appx
ファイルを zip ファイルに変更してインストールしてください。If you are using Windows server, or run into problems running the command above you can find the alternate install instructions on the Windows Server documentation page to install the .appx
file by changing it to a zip file.
ディストリビューションがインストールされたら、通常の手順に従って WSL 1 を WSL 2 に更新するか、新しいユーザー アカウントとパスワードを作成します。Once your distribution is installed, follow the normal instructions to * Update from WSL 1 to WSL 2 or create a new user account and password.