Abstract
This article explains in detail how to install the Rocky Linux subsystem in windows11. It also show how to install using WSL and WSL2, respectively.
Thanks
Thanks to rockylinux.org and learn.microsoft.com for the document.
Running environment
- Windows 11 Pro Version: 22H2.
Prerequisites
-
There is now a new WSL version available in the Microsoft Store, which has more features use this if possible.
-
Open an administrative Terminal (either PowerShell or Command-Prompt) and run wsl --install (ref.)
-
Go to Turn Windows features on or off , Turn the Windows Subsystem for Linux and the Windows Hypervisor Platform .
-
Enable virtualization in the BIOS of the computer motherboard. Virtualization switch names on different motherboards vary, for example: SVM MODE , Virtualization Technology , and Virtualization Technology .
Steps
4.1 Download the image from the CDN
Rocky Linux 9:
Base_x86_64 Minimal_x86_64 UBI_x86_64Base_aarch64 Minimal_aarch64 UBI_aarch64
4.2 extract the .tar file from the .tar.xz file
extract the .tar file from the .tar.xz file, then modify the file name to Rocky9.tar
4.3 Create the directory where the WSL will store its files
Create a folder named RockyLinux9Base in your user folder:
1 | C:\Users\<UserName>\AppData\RockyLinux9Base |
4.4 Finally, import the image into WSL
- WSL(ref.):
1 | wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-9-image.tar.xz> |
For example:
1 | wsl --import RockyLinux-9-Base C:\Users\<UserName>\AppData\RockyLinux9Base Downloads\Rocky9.tar |
- WSL2(ref.):
1 | wsl --import <machine-name> <path-to-vm-dir> <path-to/rocky-9-image.tar.xz> --version 2 |
For example:
1 | wsl --import RockyLinux-9-Base C:\Users\<UserName>\AppData\RockyLinux9Base Downloads\Rocky9.tar --version 2 |
4.5 Add WSL specific components like a default user
By default when using --import, you are always started as the root user. You can set up your own user account, but note that the set up process will vary slightly based on each different Linux distribution.
To set up user account with the Rocky distribution we just imported, first open PowerShell and boot into Rocky, using the command:
1 | wsl -d RockyLinux-9-Base |
After that please restart Terminal and You’ll find the Rocky Linux option in the dropdown menu.