Linux application running on windows

Run Linux GUI Apps in Windows With WSL 2

The WSL 2 brings the ability to run GUI Linux apps inside Windows. Here’s what you need to know and do to achieve that.

  • Enable WSL 2 and install a Linux distribution with it
  • Install appropriate graphics driver for WSL
  • Install and use GUI Linux apps

Let’s see about the steps in detail.

Requirements

As stated above, running Linux GUI applications is not available for all Windows versions. To do this, your system should be:

  • For x64 systems: Version 1903 or later, with Build 18362 or later.
  • For ARM64 systems: Version 2004 or later, with Build 19041 or later.
  • The installed Linux distribution should use WSL2

Remember that, the requirements above are solely for running Linux GUI apps. WSL is supported for some of the Windows 10 versions also. Please refer to the dedicated article detailing how to install WSL in Windows for more about WSL and its uses.

Step1: Installing Linux Distribution with WSL 2

This is a lot easier on Windows 11 which comes with built-in support for WSL 2.

On Windows 11

You can use the Microsoft Store but I find it easier to use the command line.

You need to open PowerShell with admin privileges. For this, search for Powershell in the start menu, right-click on Powershell and select Run as Administrator.

Run Powershell as an administrator

Enter the following command to install WSL.

By default, Ubuntu will be installed as the Linux distribution. If you want to install any other distribution, use the command below:

This will list all the available Linux distributions. Once you decide on the distribution, use the below command to install it.

Once finished downloading and installing, you need to reboot to apply the changes.

On Windows 10

This is a bit complicated and takes some time and effort to run WSL version 2 on Windows 10.

Ensure that the Windows Subsystem for Linux feature is turned on. Execute the following command in Powershell with admin rights:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Reboot the device once the command is completed.

After this, you need to enable the Virtual Machine Platform feature. Open the Powershell with admin privileges and enter the following command:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Once again, restart the device to complete the WSL install and update to WSL 2.

Читайте также:  What is rsync on linux

Now, download the Linux Kernel Update Package for x64 machines from the official website. If you are using ARM64 devices, use this link to download the latest kernel update package.

If you are not sure about the device architecture, enter the command below in Powershell to get the type:

systeminfo | find "System Type"

When the file is downloaded, double-click on it and finish the installation of the Kernel update package. Now, open PowerShell and run this command to set WSL 2 as the default version when installing a new Linux distribution:

Once WSL2 is set as the default version, you can now install the Linux distribution of your choice.

Go to Windows Store and install Ubuntu.

Install ubuntu 22.04 LTS version from Microsoft Store

🛠️ Configure the newly installed Ubuntu

Whether you installed WSL and Ubuntu using the Microsoft Store or the command line, you need to configure it.

Once you rebooted after installing Ubuntu, search for Ubuntu in Start Menu and open it.

Open the Installed Ubuntu from Windows Start Menu

It will ask you to enter a UNIX Username and Password. Enter these details and press enter key.

When asks for the new UNIX username and password for the newly installed Ubuntu system, enter both details

You will now be inside the terminal window of Ubuntu.

Logged into new Ubuntu 22.04 LTS in Windows 11 WSL

Once logged in, you need to update the installed Ubuntu. For this, enter the following commands one by one:

sudo apt update sudo apt full-upgrade

After completing the update, you are good to go with Ubuntu in WSL.

Running Ubuntu in WSL

Step 2: Installing GUI Applications

Once you are all set with the Linux distribution inside WSL, now is the time to install the Linux GUI application. It is done in two parts as described below.

Download and Install Graphics drivers

To run GUI apps, you need to install appropriate graphics drivers. You can use the following link to download the drivers according to your provider.

Once installed, you are all done.

Install some GUI Apps

Now, go to your Ubuntu app and install any GUI app using the APT package manager. You should note that running apps from other sources like flatpak are problematic within WSL.

For this article, I installed the Gedit text editor using the following command:

This will install several MB of packages including required libraries. Once completed, you can run the following command to start the GUI Gedit app in Windows:

Run Gedit text editor GUI in WSL Ubuntu

Similarly, you can install all the popular applications available to Linux, including Nautilus file manager, GIMP, etc. You can refer to the official documentation for more about running GUI applications in WSL.

Wrapping Up

With WSL, Microsoft has provided a comfortable way of using Linux within Windows. It keeps on improving with each major version. Running GUI Linux apps on Windows feature is proof of the same.

As you can see, it is rather simple to use WSL 2 on Windows 11. Running it on Windows 10 takes some effort.

I hope you find this tutorial helpful. Let me know if you face any difficulties.

Читайте также:  File server with linux

Источник

Running Linux programs on Windows

To run a Linux program on Windows, you have these options:

  • Run the program as-is on the Windows Subsystem for Linux (WSL). In WSL your program executes directly on the machine hardware, not in a virtual machine. WSL also enables direct filesystem calls between Windows and Linux systems, removing the need for SSL transport. WSL is designed as a command-line environment and is not recommended for graphics-intensive applications. For more information, see Windows Subsystem for Linux Documentation.
  • Run the program as-is in a Linux virtual machine or Docker container, either on your local machine or on Azure. For more information, see Virtual Machines and Docker on Azure.
  • Compile the program using gcc or clang in the MinGW or MinGW-w64 environments, which provide a translation layer from Linux to Windows system calls.
  • Compile and run the program using gcc or clang in the Cygwin environment, which provides a more complete Linux environment on Windows compared to MinGW or MinGW-w64.
  • Manually port your code from Linux and compile for Windows using Microsoft C++ (MSVC). This involves refactoring platform-independent code into separate libraries, and then re-writing the Linux-specific code to use Windows-specific code (for example, Win32 or DirectX APIs). For applications that require high performance graphics, this is probably the best option.

Feedback

Submit and view feedback for

Источник

Run Linux GUI apps on the Windows Subsystem for Linux

Windows Subsystem for Linux (WSL) now supports running Linux GUI applications (X11 and Wayland) on Windows in a fully integrated desktop experience.

WSL 2 enables Linux GUI applications to feel native and natural to use on Windows.

  • Launch Linux apps from the Windows Start menu
  • Pin Linux apps to the Windows task bar
  • Use alt-tab to switch between Linux and Windows apps
  • Cut + Paste across Windows and Linux apps

You can now integrate both Windows and Linux applications into your workflow for a seamless desktop experience.

Screenshot of Linux and Windows apps open on a desktop

Install support for Linux GUI apps

Prerequisites

  • You will need to be on Windows 10 Build 19044+ or Windows 11 to access this feature.
  • Installed driver for vGPU To run Linux GUI apps, you should first install the driver matching your system below. This will enable you to use a virtual GPU (vGPU) so you can benefit from hardware accelerated OpenGL rendering.
    • Intel GPU driver
    • AMD GPU driver
    • NVIDIA GPU driver

    Fresh install — No prior WSL installation

    You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.

    Once your machine has finished rebooting, installation will continue and you will be asked to enter a username and password. This will be your Linux credential for the Ubuntu distribution.

    You’re now ready to begin using Linux GUI apps on WSL!

    Existing WSL install

    If you already have WSL installed on your machine, you can update to the latest version that includes Linux GUI support by running the update command from an elevated command prompt.

    1. Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
    2. Enter the WSL update command:

    Linux GUI apps are only supported with WSL 2 and will not work with a Linux distribution configured for WSL 1. Read about how to change your distribution from WSL 1 to WSL 2.

    Run Linux GUI apps

    You can run the following commands from your Linux terminal to download and install these popular Linux applications. If you are using a different distribution than Ubuntu, it may use a different package manager than apt. Once the Linux application is installed, you can find it in your Start menu under the distribution name. For example: Ubuntu -> Microsoft Edge .

    Support for GUI apps on WSL does not provide a full desktop experience. It relies on Windows desktop, so installing desktop-focused tools or apps may not be supported. To request additional support, you can file an issue in the WSLg repo on GitHub.

    Update the packages in your distribution

    Install Gnome Text Editor

    Gnome Text Editor is the default text editor of the GNOME desktop environment.

    sudo apt install gnome-text-editor -y 

    To launch your bashrc file in the editor, enter: gnome-text-editor ~/.bashrc

    Install GIMP

    GIMP is a free and open-source raster graphics editor used for image manipulation and image editing, free-form drawing, transcoding between different image file formats, and more specialized tasks.

    Install Nautilus

    Nautilus, also known as GNOME Files, is the file manager for the GNOME desktop. (Similar to Windows File Explorer).

    sudo apt install nautilus -y 

    Install VLC

    VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files.

    Install X11 apps

    X11 is the Linux windowing system and this is a miscellaneous collection of apps and tools that ship with it, such as the xclock, xcalc calculator, xclipboard for cut and paste, xev for event testing, etc. See the x.org docs for more info.

    sudo apt install x11-apps -y 

    To launch, enter the name of the tool you would like to use. For example:

    Install Google Chrome for Linux

    To install the Google Chrome for Linux:

    1. Change directories into the temp folder: cd /tmp
    2. Use wget to download it: sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    3. Get the current stable version: sudo dpkg -i google-chrome-stable_current_amd64.deb
    4. Fix the package: sudo apt install —fix-broken -y
    5. Configure the package: sudo dpkg -i google-chrome-stable_current_amd64.deb

    To launch, enter: google-chrome

    Install Microsoft Edge browser for Linux

    Find information on how to install the Microsoft Edge browser for Linux using the command line on the Edge Insider site. Select Get instructions under the Command line installation section of the page.

    To launch, enter: microsoft-edge

    Troubleshooting

    If you have any problem starting GUI applications please check this guide first: Diagnosing «cannot open display» type issues with WSLg

    Feedback

    Submit and view feedback for

    Источник

Оцените статью
Adblock
detector