|
| 1 | +# How to Set Up ArchWSL |
| 2 | + |
| 3 | +A brief guide to setup ArchLinux distribution on WSL. |
| 4 | + |
| 5 | +## Install ArchLinux in WSL2 |
| 6 | + |
| 7 | +- Follow this link: [yuk7's ArchWSL](https://github.com/yuk7/ArchWSL) and grab a ArchWSL version. |
| 8 | +- Download ZIP file and extract it to your desired location. |
| 9 | +- Navigate to the extracted folder and run the `.exe` file. |
| 10 | + |
| 11 | +Those steps above can be done in a [PowerShell](https://github.com/PowerShell/PowerShell) console: |
| 12 | + |
| 13 | +```pwsh |
| 14 | +Set-Location "H:\test" |
| 15 | +
|
| 16 | +& curl.exe -sSfL "https://github.com/yuk7/ArchWSL/releases/download/25.3.2.0/Arch.zip" -o Arch.zip |
| 17 | +
|
| 18 | +Expand-Archive .\Arch.zip |
| 19 | +Remove-Item .\Arch.zip -Force -Recurse -ErrorAction SilentlyContinue |
| 20 | +
|
| 21 | +. .\Arch.exe |
| 22 | +``` |
| 23 | + |
| 24 | +Other methods to setup ArchWSL is in this **[LINK](https://wsldl-pg.github.io/ArchW-docs/How-to-Setup/)** |
| 25 | + |
| 26 | +Now run ***`wsl -l -v`*** in your `PowerShell` or `Command Prompt` terminal, you should see `Arch` on the list. |
| 27 | + |
| 28 | +To start `ArchWSL`, simply run ***`wsl -d Arch`***. |
| 29 | + |
| 30 | +## Setup ArchWSL's default user |
| 31 | + |
| 32 | +Inside the `Arch` instance, create a default user: |
| 33 | + |
| 34 | +```bash |
| 35 | +# Setup root password |
| 36 | +passwd |
| 37 | + |
| 38 | +# Setup sudoers file |
| 39 | +echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/wheel |
| 40 | + |
| 41 | +# Add default username and password |
| 42 | +username=johndoe |
| 43 | +useradd -m -G wheel -s /bin/bash $username |
| 44 | +passwd $username |
| 45 | + |
| 46 | +exit |
| 47 | +``` |
| 48 | + |
| 49 | +Now run: |
| 50 | + |
| 51 | +```pwsh |
| 52 | +wsl.exe --terminate Arch |
| 53 | +
|
| 54 | +.\Arch.exe config --default-user johndoe |
| 55 | +
|
| 56 | +wsl.exe -d Arch |
| 57 | +``` |
| 58 | + |
| 59 | +Initialize keyring for use with `pacman` |
| 60 | + |
| 61 | +```bash |
| 62 | +sudo pacman-key --init |
| 63 | +sudo pacman-key --populate |
| 64 | +sudo pacman -Sy archlinux-keyring |
| 65 | +sudo pacman -Su |
| 66 | +``` |
| 67 | + |
| 68 | +## References |
| 69 | + |
| 70 | +- [Import and Linux distribution to use with WSL](https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro) |
| 71 | +- [How to Set Up ArchWSL](https://wsldl-pg.github.io/ArchW-docs/How-to-Setup/) |
0 commit comments