環境
- Windows 11 Pro バージョン 23H2 OS ビルド 22631.3007
- vs-code 1.86.1
- PowerShell 7.4.0
WSLのインストール
参考:
1 つのコマンドを使用して、WSL を実行するために必要なすべてのものをインストールできるようになりました。
- インストール
wsl --install インストール中: 仮想マシン プラットフォーム 仮想マシン プラットフォーム はインストールされました。 インストール中: Linux 用 Windows サブシステム Linux 用 Windows サブシステム はインストールされました。 インストール中: Ubuntu Ubuntu はインストールされました。 要求された操作は正常に終了しました。変更を有効にするには、システムを再起動する必要があります。
- 再起動後、ユーザー名とパスワードを設定します。
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: test New password: Retype new password:
- インストールが完了したら、
exit
で終了します。
Installation successful! To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. Welcome to Ubuntu 22.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 This message is shown once a day. To disable it please create the /home/test/.hushlogin file.
VS CodeにWLS拡張機能をインストールする
- Remote Development v0.25.0
このリモート開発拡張パックには、次の 4 つの拡張機能が含まれています。
- Remote-SSH
- Remote-Tunnels
- Dev Containers
- WSL
WSLバージョンの確認
PS C:\Users\admin> wsl --list --verbose NAME STATE VERSION * Ubuntu Stopped 2
パッケージの更新とアップグレード
PS C:\Users\admin> wsl test@VJS121C12N:/mnt/c/Users/admin$ sudo apt update && sudo apt upgrade -y
Ubuntuのバージョン確認
test@VJS121C12N:/mnt/c/Users/admin$ cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy
以上です。