ホーム 暮らし Introduction to WSL (Windows Subsystem for Linux)

Introduction to WSL (Windows Subsystem for Linux)

八木 麻衣 八木 麻衣 • 更新: • 公開: • 読了約 13 分
目次
n3a2563f2f9de

When performing embedded systems development, there are cases where a UNIX-based Linux environment is assumed.

Previously, due to differences in the underlying OS, it was difficult to handle on Windows PCs, and Macs were easier to work with because their consoles were also UNIX-based, but since Windows 10, WSL was introduced and it has become significantly easier.

WSL has evolved from 1 to 2, and in Windows 11, it can be used very comfortably as a part of the OS functionality.

From now on, instead of searching for and using Linux tools built for Windows, I think it is easier to use Linux tools within a WSL Linux environment.

Introduction of the WSL environment

It has changed year by year depending on the Windows version, and the commands required for installation have changed, but it has become easier than before.

In the Windows 10 era, please go to 'Control Panel' -> 'Programs' -> 'Turn Windows features on or off' -> and check 'Windows Subsystem for Linux'.

Checking the current status

Please launch PowerShell or the command line (integrated into Terminal in Windows 11).

PS C:\Users\your user name>wsl.exe --version

If it is installed, the version information will appear.

PS C:\Users\your user name>wsl.exe --update

This updates WSL itself to the latest state.

First, display the list of installable Linux distributions with the following.

PS C:\Users\your user name>wsl.exe --list --online

The following is the list as of August 2026.

Ubuntu Ubuntu
Ubuntu-26.04 Ubuntu 26.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
openSUSE-Tumbleweed openSUSE Tumbleweed
openSUSE-Leap-16.0 openSUSE Leap 16.0
SUSE-Linux-Enterprise-15-SP7 SUSE Linux Enterprise 15 SP7
SUSE-Linux-Enterprise-16.0 SUSE Linux Enterprise 16.0
kali-linux Kali Linux Rolling
Debian Debian GNU/Linux
AlmaLinux-8 AlmaLinux OS 8
AlmaLinux-9 AlmaLinux OS 9
AlmaLinux-Kitten-10 AlmaLinux OS Kitten 10
AlmaLinux-10 AlmaLinux OS 10
archlinux Arch Linux
FedoraLinux-44 Fedora Linux 44
FedoraLinux-43 Fedora Linux 43
eLxr eLxr 12.12.0.0 GNU/Linux
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_10 Oracle Linux 8.10
OracleLinux_9_5 Oracle Linux 9.5
SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
PS C:\Users\your user name>wsl.exe --install

You can install it with this, but in this case, it will likely be the standard Ubuntu (probably the latest Ubuntu at that time).

This time, I want to build an embedded ROS2 environment, so I will specify Ubuntu-24.04.

PS C:\Users\your user name>wsl.exe --install -d Ubuntu-24.04

With this, Ubuntu will run, and an Ubuntu icon will be added to Windows. If you click it, a terminal will launch, but you should pin the icons. Once the terminal launches, you will operate it using the bash shell.

Here is a slight detour for those who are not yet used to Ubuntu knowledge. Perform updates periodically for security measures. Use Sudo. It is a command that executes the command following sudo with administrator privileges.
However, for embedded environments and the like, other updates may cause things to stop working, so be careful when updating near a deadline.

account@machine:~/$ sudo apt update
account@machine:~/$ sudo apt upgrade

*However, for embedded environments and the like, other updates may cause things to stop working, so be careful when updating near a deadline.

Back in the days of WSL1, various settings were required to run Linux-based GUI environments, but in WSL2, they can be used easily.

In Ubuntu, launch the terminal on Windows and use bash to

account@machine:~/$ sudo apt install x11-apps 

Japanese settings
Reasons why Japanese might not work correctly include settings being in English, missing Japanese modules, or the lack of fonts to display Japanese.
Previously, Japanese modules were often missing, but nowadays, many things can be handled through settings.

account@machine:~/$ sudo apt install language-pack-ja
account@machine:~/$ sudo update-locale LANG=ja_JP.UTF-8

Font

account@machine:~/$ sudo apt install fonts-ipafont

※ Additionally, for MS fonts use ttf-mscorefonts-installer, and for others use fonts-ipaexfont, fonts-noto-cjk, fonts-noto-cjk-extra, and fonts-takao

※ Bonus: Key repeat settings due to compatibility with Windows keyboards

account@machine:~/$ sudo apt install x11-xserver-utils
account@machine:~/$ xset -r 49

Finally, if you made a mistake and want to start over, launch the initial Windows PowerShell and then

PS C:\Users\your user name> wsl --l -v

Specify the name of the relevant item from the list displayed above to delete it.

PS C:\Users\your user name> wsl --unregister Ubuntu

※ It deletes quickly.
Make sure to copy important files to the Windows side. The Windows C drive is located at /mnt/c/ on the Linux side.

Bonus
Copying and pasting from Windows to the WSL2 bash is done with Shift + Ctrl + v. This makes pasting long commands quite easy.

同じカテゴリの記事

八木 麻衣
トレンドリサーチャー 八木 麻衣
プロフィールを見る →

全記事の事実確認を担当。一次情報・公式発表・公開資料の三点を確認できない場合は公開を見送る判断をします。

おすすめの関連記事