Running Ubuntu 24.04 on Windows 11 with GUI Using WSL

Running Ubuntu 24.04 on Windows 11 with GUI Using WSL

Windows Subsystem for Linux (WSL) is a feature in Windows 11 that allows users to run a Linux environment directly on their Windows machines without the need for dual-booting or using a virtual machine. This integration facilitates developers and enthusiasts to leverage Linux tools alongside Windows applications seamlessly.

Enabling WSL on Windows 11

1. Enable Hardware Virtualization

Ensure that hardware virtualization is enabled in your system’s BIOS settings. This feature is typically labeled as Intel VT-x, AMD-V, or SVM. You can verify its status by opening Task Manager, navigating to the “Performance” tab, selecting “CPU,” and checking if “Virtualization” is marked as “Enabled.”

2. Install WSL Feature

Open the search bar, type “Turn Windows features on or off”, and select it.
Enable the “Virtual Machine Platform” and “Windows Subsystem for Linux” options.
Click Apply and reboot your computer.

3. Install WSL

Open Windows Terminal with administrative privileges and execute the following command:

wsl --install

List available Linux distributions with:

wsl --list --online


This command installs the default Linux distribution. To install a specific distribution, such as Ubuntu 24.04, use:

wsl --install -d Ubuntu-24.04

After installation, set up your Linux username and password as prompted. You will need to use this later during Remote Desktop.

Updating Ubuntu

sudo apt update && sudo apt upgrade

Updating and Configuring WSL

Update WSL to the Latest Version

wsl --update
wsl --shutdown

Set WSL Version

Ensure you’re using WSL 2, which offers improved performance and full system call compatibility:

wsl --set-default-version 2

To check the version of a specific distribution:

wsl --list --verbose

If needed, upgrade a distribution to WSL 2:

wsl --set-version <distribution_name> 2

Running Linux GUI Applications

With WSLg (Windows Subsystem for Linux GUI), you can run Linux GUI applications directly on Windows. After installing your desired GUI applications within the Linux environment, they can be launched from the Windows Start menu or via the terminal. For example, to install GIMP:

sudo apt install gimp htop blender kdenlive krita

Once installed, GIMP and other applications will appear in the Windows Start menu under the Linux distribution’s folder.

Setting Up a Full Linux Desktop Environment

For a more immersive experience, you can set up a full Linux desktop environment like XFCE:

1. Install XFCE and XRDP

sudo apt update
sudo apt install xfce4 xfce4-goodies xrdp

2. Configure XRDP

sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
sudo /etc/init.d/xrdp start

3. Configure the XRDP window manager

sudo nano /etc/xrdp/startwm.sh

then comment the lines by seeing the screenshot below by adding a HASH tag at the beginning of each statement, Then at the bottom a statement to startxfce4

4. Connect to the Desktop Environment

  • Open the Remote Desktop Connection app on Windows.
  • Connect to localhost:3390.
  • Log in with your Linux credentials to access the XFCE desktop.

Conclusion

By integrating Ubuntu 24.04 with Windows 11 through WSL, you can harness the strengths of both operating systems, creating a versatile and efficient computing environment tailored to diverse development and operational needs.