Windows11/10 WSL2のUbuntu20.04 LTSの立ち上げ

この記事は 2 分で読めます。
概要

Windows10/11のWSL2上でUbuntu20.04の立ち上げを方法を紹介します。

本記事の読者層

WSL2上でUbuntu20.04を立ち上げたい方

目次

はじめに

2023年にUbuntu18.04LTSのサポートが終了しました。これにより18.04から20.04へアップグレードが必要になります。

2023年5月31日のUbuntu 18.04 LTS標準サポート終了

WindowsのWSL2を移動後にUbuntu20.04を立ち上げる方法を確認していきます。

エラー

Ubuntuのイメージディスク

ext4.vhdx

がうまく接続されていない場合、以下のようなエラーがでます。

ディスク 'C:\Users\(users)\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx' を WSL2 にアタッチできませんでした: プロセスはファイルにアクセスできません。別のプロセスが使用中です。
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_SHARING_VIOLATION
Press any key to continue...

WSL2でUbuntu20.04を立ち上げる方法

WSL2で立ち上がっていない場合は、以下の方法でWSL2をインストールください。

次にWSL2でUbuntu20.04を立ち上げるには以下のコマンドを入力してください。

> wsl --install -d Ubuntu
Ubuntu を起動しています...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username:
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: user
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun Dec 24 16:33:52 JST 2023

  System load:  0.12                Processes:             9
  Usage of /:   0.1% of 1006.85GB   Users logged in:       0
  Memory usage: 0%                  IPv4 address for eth0: 172.18.215.131
  Swap usage:   0%

1 update can be applied immediately.
To see these additional updates run: apt list --upgradable


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


This message is shown once a day. To disable it please create the
/home/tomita/.hushlogin file.
WordPressのホスト環境
  • Linux Ubuntu
    20.04 on Windows
18.04.6LTS

Windows WSL2上で20.04 on Windowsと18.04.6 LTSを併用してLinux環境を整えてみます。

まとめ

本記事のまとめ

本記事のまとめは、

WSL2でUbuntu20.22立ち上げについて解説しました。

関連リンク

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする

目次