Windows Installation of Desktop WSL2 Linux Subsystem
Running a Linux desktop on Windows using WSL 2 (Windows Subsystem for Linux) is currently the highest-performing, most memory-efficient, and smoothest experience solution.
Rendering...
## Translation Requirements
1. **Retain all Markdown formatting, with examples:**
* Heading markers (`# ## ###` etc.) must be fully retained.
* List markers (`- * +` or numbers) must be fully retained.
* Code block markers (```` ```language ````) must be fully retained.
* Inline code markers (`` `code` ``) must be fully retained.
* Link format (`[text](URL)`) must be fully retained, only translate the text part.
* Image markers (``) must be fully retained.
* Link URLs (e.g., `https://example.com`) **must absolutely NOT be translated or modified**.
* Retain all special characters (e.g., `$, %, &, <, >` etc.).
* Retain all spaces and line breaks.
* Retain all HTML entities (e.g., ` <` etc.).
* Retain the original line break structure.
* Table format must be fully retained.
* Other unmentioned special formats, judge whether translation is needed based on actual circumstances.
* Addition: Do not add any headings, lists, or other special formats that were not originally present.
2. **Translation Quality**:
* The translation should be natural and fluent, conforming to the expression habits of the target language.
* Technical terms should remain accurate; retain the English original when necessary.
* Maintain the tone and style of the original text.
3. **Output Requirements**:
* **Only output the translated Markdown text.**
* **Do not add any explanations, descriptions, or comments other than the translated content.**
* **Do not add prefixes like "Translation Result:".**
* **Directly output the complete translated content.**
## Translated Text
Running a Linux desktop on Windows using **WSL 2 (Windows Subsystem for Linux)** is currently the highest-performance, most memory-efficient, and smoothest solution. Microsoft officially supports **WSLg** (WSL Graphic) natively, which means you can run Linux GUI graphical applications directly on Windows **without any complex configuration**; if you want to experience a **complete Linux windowed desktop** (such as Ubuntu/XFCE), it only requires a few simple steps.
Below is the complete installation and usage tutorial:
## Preparation
- **System Requirements**:
- Windows 10 (version 2004 and above, build 19041 and above)
- Windows 11 (recommended, best experience, native support for WSLg graphics acceleration)
- **Hardware Requirements**: **Hardware virtualization (VT-x / AMD-V)** must be enabled in the BIOS (most modern computers have this enabled by default).
## Step One: One-click Enable and Install WSL 2
Microsoft now provides a "one-click install" command that automatically enables Windows virtualization components, downloads the latest Linux kernel, and installs Ubuntu by default.
1. **Open Terminal as Administrator**:
- Press `Win + X` on your keyboard, then select **Terminal (Admin)** or **PowerShell (Admin)**.
2. **Run the installation command**: In the terminal, type the following command and press Enter:
```PowerShell
wsl --install
```
3. **Restart your computer**:
- After the command finishes executing, **restart your computer** as prompted to enable the system's virtualization components.
4. **Initialize Ubuntu account**:
- After restarting and entering Windows, a black command line window will automatically pop up, displaying `Installing, this may take a few minutes...`.
- Wait a moment, then follow the prompts to enter your custom **Linux Username** and **Password** (*Note: Characters will not be displayed on the screen when entering the password; just type it and press Enter*).
- When you see `username@computername:~$`, WSL 2 has been successfully installed!
> **Tip**: If you want to install other Linux distributions (such as Debian, Arch, Kali), you can type `wsl --list --online` in PowerShell to view the list, then use `wsl --install -d <DistroName>` to install.
## Step Two: Using Linux (Two Common Methods)
### Method One: Directly Run Single Linux GUI Application (Official WSLg Mode, Most Recommended)
In Windows 10/11, you **do not need to install any third-party software** to directly launch graphical software from the Linux command line, and it will appear as an independent window, just like a native Windows application.
1. Update software sources in the WSL terminal:
```Bash
sudo apt update && sudo apt upgrade -y
```
2. Test installing and running a Linux graphical software (e.g., Gedit editor or GIMP image processing tool):
```Bash
sudo apt install gedit -y
gedit
```
You will find that `Gedit` will pop up directly as a Windows window! At the same time, shortcuts for Linux software will also be automatically generated in the Windows "Start Menu".
### Method Two: Run Full Linux Desktop (with Desktop Wallpaper, Taskbar)
If you want a **complete Linux desktop** like a traditional virtual machine (including a start menu, desktop icons, and taskbar), the lightest and most stable way is to combine **XFCE Desktop + Remote Desktop**.
#### 1. Install XFCE Desktop and xrdp in WSL 2
Run the following commands line by line in the Ubuntu terminal:
```Bash
# 1. Update software list
sudo apt update
# 2. Install lightweight XFCE desktop environment
sudo apt install xfce4 xfce4-goodies -y
# 3. Install remote desktop service (xrdp)
sudo apt install xrdp -y
# 4. Backup and configure xrdp to use xfce4 desktop
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
echo "startxfce4" > ~/.xsession
# 5. Start xrdp service
sudo service xrdp start
```
#### 2. Connect to the Linux Desktop
1. Open Windows **Remote Desktop Connection** (press `Win + R`, type `mstsc`, and press Enter).
2. In the "Computer" field, enter:
```Plaintext
localhost:3390
```
3. Click **Connect** (if a security warning pops up, check "Don't ask me again" and click "Yes").
4. In the login interface that appears:
- **Session**: Keep `Xorg`
- **username**: Enter your WSL username
- **password**: Enter your WSL password
5. Click **OK**, and you will see a smoothly running full Linux desktop!
## Step Three: Common Management and Tips
### 1. Common WSL Command Lines (Run in Windows PowerShell)
- **View installed systems and WSL versions**:
```PowerShell
wsl -l -v
```
*(Ensure VERSION shows as 2)*
- **Shut down WSL virtual machine (release memory)**:
```PowerShell
wsl --shutdown
```
- **Restart WSL**:
```PowerShell
wsl --shutdown
wsl
```
### 2. Windows and Linux File Interoperability
- **View Linux files in Windows**: Open Windows File Explorer, and at the bottom of the left sidebar, you will see **Linux (or a penguin icon)**. Click it to access Ubuntu files just like reading and writing to a local hard drive. Or, in the WSL terminal, type:
```Bash
explorer.exe .
```
- **Access Windows drives in Linux**: Windows C: drive, D: drive, etc., are automatically mounted under Linux's `/mnt/` directory. For example, to access the C: drive:
```Bash
cd /mnt/c
```
## Troubleshooting Common Issues
1. **Executing `wsl --install` reports error: `0x80370102`**
- **Reason**: Hardware virtualization is not enabled in the BIOS.
- **Solution**: Restart your computer, enter BIOS/UEFI settings, find `Intel Virtualization Technology` or `SVM Mode`, and enable it.
2. **After closing Remote Desktop, cannot connect next time?**
Because the `xrdp` service may not start automatically every time WSL restarts. Before entering the desktop each time, run the following command in the WSL terminal to start the service:
```Bash
sudo service xrdp start
```
If you want to automatically start xrdp, you can read [Configure WSL2 Linux Virtual Machine to Automatically Start xrdp](https://www.lodenhu.com/post/configure-wsl2-linux-virtual-machine-to-automatically-start-xrdp).Comments
Please login to view and post comments
Go to Login