- Run Linux GUI apps on the Windows Subsystem for Linux (preview)
- Install support for Linux GUI apps
- Prerequisites
- Fresh install — No prior WSL installation
- Existing WSL install
- Run Linux GUI apps
- Update the packages in your distribution
- Install Gedit
- Install GIMP
- Install Nautilus
- Install VLC
- Install X11 apps
- Install Google Chrome for Linux
- Install Microsoft Teams for Linux
- Install Microsoft Edge browser for Linux
- How to Run Linux on Windows 10
- Defining Bash
- Enabling Linux on Windows
- Use PowerShell
- Use Windows Features
- Downloading a Linux Distro
- Running Linux
- How to run graphical Linux applications on Windows 10 using the Windows Subsystem for Linux (WSL)
- Prerequisites
- Enable the Windows Subsystem for Linux feature
- GUI Method
- Command-line Method
- After enabling Windows Subsystem for Linux
- Install your Linux distribution of choice
- Create a UNIX user
- Update the Linux distribution
- Install common tools
- Accessing the Windows filesystem from WSL
- Graphical Applications
- Install VcXsrv
- Configure bash to use the local X server
- Instructions for fish shell users
- Test a graphical application
- Running remote GUI applications over SSH
- Using Visual Studio Code
- References
- 64 thoughts on “How to run graphical Linux applications on Windows 10 using the Windows Subsystem for Linux (WSL)”
Run Linux GUI apps on the Windows Subsystem for Linux (preview)
You can now preview Windows Subsystem for Linux (WSL) support for 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.
Install support for Linux GUI apps
Prerequisites
You will need to be on Windows 11 Build 22000 or higher to access this feature. You can join the Windows Insiders Program to get the latest preview builds.
Installed driver for vGPU
To run Linux GUI apps, you should first install the preview driver matching your system below. This will enable you to use a virtual GPU (vGPU) so you can benefit from hardware accelerated OpenGL rendering.
Fresh install — No prior WSL installation
If you have not already done so, install WSL and set up a user name and password for your Linux distribution.
Open a command prompt with administrator privileges.
Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
Run this command and reboot your machine when prompted:
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.
Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
Enter the WSL update command:
You will need to restart WSL for the update to take effect. You can restart WSL by running the shutdown command in PowerShell.
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 .
Update the packages in your distribution
Install Gedit
Gedit is the default text editor of the GNOME desktop environment.
To launch your bashrc file in the editor, enter: gedit
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.
To launch, enter: gimp
Install Nautilus
Nautilus, also known as GNOME Files, is the file manager for the GNOME desktop. (Similiar to Windows File Explorer).
To launch, enter: nautilus
Install VLC
VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files.
To launch, enter: vlc
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.
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:
- Change directories into the temp folder: cd /tmp
- Use wget to download it: sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- Get the current stable version: sudo dpkg -i google-chrome-stable_current_amd64.deb
- Fix the package: sudo apt install —fix-broken -y
- Configure the package: sudo dpkg -i google-chrome-stable_current_amd64.deb
To launch, enter: google-chrome
Install Microsoft Teams for Linux
To install Microsoft Teams for Linux:
- Change directories into the temp folder: cd /tmp
- Use curl to download the package: sudo curl -L -o «./teams.deb» «https://teams.microsoft.com/downloads/desktopurl?env=production&plat=linux&arch=x64&download=true&linuxArchiveType=deb»
- Use apt to install it: sudo apt install ./teams.deb -y
To launch, enter: teams
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.
Источник
How to Run Linux on Windows 10
Linux users celebrated when it was reported that Bash shell was coming to Windows. And while it was not readily available to all users at first, the Windows 10 Creators Update made Linux on Windows more accessible.
Want to join in on the fun? Here’s how you can have Linux on Windows operating system without having to go through a virtual machine.
Defining Bash
Bash is basically a subsystem for Ubuntu. With Bash, you have a Linux system running inside Windows. It’s the very same Bash you’d find in Linux. You can use it to execute Linux commands without the need for a virtual machine or dual booting.
Using Bash shell, developers can experience Linux natively on a Windows machine.
Enabling Linux on Windows
There are two ways of enabling a Windows subsystem for Linux. One is through PowerShell and the other would be through Windows Features.
Use PowerShell
Search for PowerShell and run it as an administrator. Once open, type this command and press Enter after:
You will be prompted to confirm by hitting Y or N. Press Y to proceed then reboot your computer. If it’s already installed, you won’t have to restart.
Use Windows Features
Use Search to look for a Control Panel application called Turn Windows Features On or Off.
Note: You can also get to the application by heading directly to Control Panel > Programs > Programs and Features > Turn Windows Features On or Off.
Once open, go through the list of features until you find Windows Subsystem for Linux. Tick the box to enable the option.
The computer will run and apply some changes. After it’s done, you will be asked to restart your computer.
Downloading a Linux Distro
Windows should now be able to run Linux. Now you have to download a Linux distro like Ubuntu for Windows to enter Linux commands.
Simply head on over to the Microsoft Store and download the Linux distro of your choice. You need to be logged in to proceed.
There are multiple systems available, but we’ll install Ubuntu and use it throughout the rest of this post. The download will likely take a while because of the large file size.
Running Linux
The Linux system you installed will run like a regular Windows application. Open Ubuntu. It will perform a one-time installation. You will be able to use Ubuntu Linux faster the next time you open the application.
Once installed, you will be asked to enter a username and a password. Provide all the necessary information.
From here on out, you will be able to go through the directory as you would in Linux. You will need to use SUDO APT to run root commands. You can also use APT-GET, APT INSTALL, AND APT UPDATE. You’re pretty much free to do everything you can do in a Linux terminal.
One thing to remember is that the Windows files system will be located inside the MNT folder.
If you want to edit Windows files from the Linux system, you would have to enter CD MNT, do LS then enter CD C and another LS to locate all the files stored inside Windows. Enjoy Linux with Windows 10!
Christopher Jan Benitez is a freelance writer for hire who provides actionable and useful web content to small businesses and startups. In his spare time, he religiously watches professional wrestling and finds solace in listening to ’80s speed metal. Read Christopher’s Full Bio
Источник
How to run graphical Linux applications on Windows 10 using the Windows Subsystem for Linux (WSL)
The Windows Subsystem for Linux (WSL) was introduced by Microsoft in the Windows 10 Anniversary Update. It allows users to run a full Linux user space in Windows. It is a much nicer approach for most applications than Cygwin, or using a Linux VM. It is not an emulator either. Think of it as GNU/Linux/Windows (apologies to Richard Stallman). This guide starts off with Microsoft’s instructions for installing the WSL, and then goes a few steps further by describing how to run graphical Linux applications.
Prerequisites
Your PC must be running (at a minimum) a 64-bit version of Windows 10 with the Anniversary Update. The Creator’s Update is recommended.
To find your PC’s CPU architecture and Windows version/build number, open Settings>System>About. Look for the System Type and Version fields respectively, as shown in the screenshot below.
If your build is below 14393, try checking for updates.
Enable the Windows Subsystem for Linux feature
You can enable the feature using a GUI or command-line interface.
GUI Method
- From the Start Menu, search for “Turn Windows features on or off” (type ‘turn’)
- Select Windows Subsystem for Linux
- Click OK
Command-line Method
Open a PowerShell prompt as administrator and run:
After enabling Windows Subsystem for Linux
Restart your computer when prompted.
It is important that you DO restart when prompted as some of the infrastructure which the Windows Subsystem for Linux requires can only be loaded during Windows’ boot-up sequence.
Install your Linux distribution of choice
Linux distributions can be installed using a script, or by using the Microsoft Store links below:
After installation your Linux distribution will be located at: %localappdata%\lxss\ This directory is marked as a hidden system folder for a very good reason:
Avoid creating and/or modifying files in this location using Windows tools and apps! If you do, it is likely that your Linux files will be corrupted and data loss may occur. Please read this blog post for more information.
Create a UNIX user
The first time you launch a Linux distribution in Windows, you will be prompted to create a UNIX username and password.
This UNIX username and password has no relationship to your Windows username and password, and it can be different.
Use the same username that you use on remote Linux/UNIX systems, so you won’t need to specify it in individual configuration files, or every time you run commands like ssh . Read more.
Update the Linux distribution
After you have set up your user, update the OS.
To do this on Debian/Ubuntu based distributions, run:
Install common tools
The Debian distribution for WSL is minimal, so many packages that you might expect to be installed, such as ca-certificates, are not installed. To fix this, run:
sudo apt install -y ca-certificates findutils command-not-found vim nano curl openssh-client less screen apt-utils top htop whois git python3-pip
Accessing the Windows filesystem from WSL
Windows drives are mounted by their drive letters under /mnt . For example, your Windows C: drive is accessible via /mnt/c.
To make it easier to access your Windows user directory, consider adding a symbolic link, such as:
On Amazon WorkSpaces, this your Windows user directory is located in /mnt/d/Users .
That way, your Windows user directory is accessible from
Graphical Applications
In order to run Linux GUI applications using WSL, you must:
- Install a X server for Windows
- Configure bash to tell GUIs to use the local X server
Install VcXsrv
In order to run graphical Linux applications, you’ll need an X server.
VcXsrv is the only fully open source and up-do-date native X server for Windows. Download and run the latest installer, then locate the XLaunch shortcut in the Start Menu, and click it.
You will be greeted with a setup wizard. Accept the default options. On the last page of the wizard, click on the Save configuration button, and save the configuration file in %appdata%\Microsoft\Windows\Start Menu\Programs\Startup , so vcXsrv will launch at startup without asking about these options, then click on the Finish button.
You may receive a prompt to allow it through your firewall. Cancel/deny this request! Otherwise, other computers on your network could access the server.
A X icon will appear in your system tray.
Configure bash to use the local X server
- In bash run:
echo «export DISPLAY=localhost:0.0» >>
/.bashrc
To have the configuration changes take effect, restart bash, or run:
.
Instructions for fish shell users
If you use fish instead of bash:
- echo «set -x DISPLAY localhost:0.0» >>
/.config/fish/config.fish
To have the configuration changes take effect, restart fish, or run:
.
Test a graphical application
- Install x11-apps
sudo apt-get install x11-apps - Run xeyes
A new window will open, containing a pair of eyes that will follow your mouse movements.
Running remote GUI applications over SSH
To use a GUI application from a server, simply use the -X switch with the ssh command, for example:
And run the GUI application from the shell prompt.
Using Visual Studio Code
Instead on installing the Linux version on Visual Studio Code on your WSL Linux distribution, install Visual Studio Code in Windows, and add the Remote Development extension pack.
After reloading Visual Studio Code, click on the green arrows at the bottom right corner of the window, and select Remote-WSL: New window action.
A new window will open with a Linux shell and editor. You will be able to edit files on the Linux file system.
Any Visual Studio Code extensions need to be installed in your Windows instance of Visual Studio Code first, and then on the WSL instance.
Recommended extensions for information security professionals include:
References
64 thoughts on “How to run graphical Linux applications on Windows 10 using the Windows Subsystem for Linux (WSL)”
I followed all the steps, but when I start VcXsrv, it finish suddenly
A fatal error has occurred and VcXsrv will now exit
Cannot move old log file…
Please open xxxxx\VCXsrv.0.log for more information
This is the content of that log
Welcome to the VcXsrv X Server
Vendor: The VcXsrv Project
Release: 1.19.2.0
OS: Windows NT 6.2 build 9200 (64-bit)
Contact: [email protected]
LoadPreferences: C:\Users\Sergio\AppData\Roaming\.XWinrc not found
LoadPreferences: Loading C:\Program Files\VcXsrv\system.XWinrc
Warning: Locale not supported by X, falling back to ‘C’ locale.
(II) AIGLX: enabled GLX_MESA_copy_sub_buffer
(II) AIGLX: enabled GLX_SGI_swap_control
(II) 103 pixel formats reported by wglGetPixelFormatAttribivARB
(II) GLX: Initialized Win32 native WGL GL provider for screen 0
winClipboardThreadProc – DISPLAY=127.0.0.1:0.0
OS maintains clipboard viewer chain: yes
Great article. I was actually looking for way to plot octave graphs in nice separate windows instead of the terminal. This solution is much more general that what I was searching for.
This worked like a charm for tkinter, thanks!
Worked great for X forwarding from a Linux machine to Windows over SSH. Thank you very much.
Worked here in surface pro 3. Thankss
i forget password, how to change?
See this post for details on how to reset the password https://askubuntu.com/a/808425
Worked here, thank you! 🙂
when I entered gedit command it’s shoes this please help to find the solution
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
seems to work perfectly for me
Worked like a champ!
thanks it wordked
Worked perfectly — thanks so much!
Hi I am trying to open graphical softwares over SSH. It works locally however when I try to connect to another server I get “Error: can’t open display: localhost:0.0”. Is there ant way to solve that?
When connecting to the remote server, be sure to add the -X switch to the ssh command.
what should this look like because I am having the same problem.
What a great article.
Thanks.
Worked like a charm on my Windows 10.
Boom! It works! Windows 10 April 2018 Update!
Thanks!
Thanx. All works
Worked nicely. Thank you!
Works well ! Thank you!
Worked like a charm. Thank you!
Great post, very helpful
Hi when I am trying to open gedit it is showing Unable to init server: could not connect: Connection refused.
Gtk- Warning: can’t open display
Please give me solution for this.
This works well up to displaying X based Apps under Windows 10 Ubuntu.
But I cannot see my mouse pointer within the X Windows graphics. How do I make my Mouse visible ?
New to Windows 10 Pro and Ubuntu 18.04 LTS (but not to *nix, via MacOSX). Reinstalled Win10 and Ubuntu a couple of times trying to get a GUI working in WSL. Turns out, what one needs is this list of steps. Had Ubuntu installed, WSL set, VcXsrv installed, even the DISPLAY command added, but still no GUI. It really helps to set Developer mode. Also, the strings added by some other “how to” step-by-each guides aren’t necessary (yet). Appreciated greatly.
All went fine…now to see what we can do!
I can open and mostly use the XFCE4 desktop usin XLAUNCH.
This works great, thank you. On the newer Win 10 versions (as of Feb 2019) you download Ubantu from the Store rather than typing “bash” in at the command line. Otherwise everything else works.
Works like a charm. Thanks!
Error: Can’t open display:
i followed all the steps then i got this when i run xeyes
I followed all the steps but for installing bash it prompted the message that to visit Microsoft store that install it from there.
estoy usando VcXsrv sin problemas
https://sourceforge.net/projects/vcxsrv/
export DISPLAY=:0
echo “export DISPLAY=localhost:0.0” >> bashrc
./bashrc
apt-get install xfce4
xlaunch
carpeta linux
“C:\Users\tu-user\AppData\Local\lxss”
apt-get install x11-apps
xbiff, xcalc, xconsole, xedit y xman
when i use gedit it generate lots of error but it runs completely fine?
this are the errors.
(gedit:24): GLib-GIO-CRITICAL **: 09:32:35.375: g_dbus_proxy_new_sync: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed
(gedit:24): dconf-WARNING **: 09:32:35.448: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(gedit:24): dconf-WARNING **: 09:32:35.460: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(gedit:24): dconf-WARNING **: 09:32:35.992: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(gedit:24): dconf-WARNING **: 09:32:35.993: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
(gedit:24): dconf-WARNING **: 09:32:35.994: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
** (gedit:24): WARNING **: 09:32:38.623: Set document metadata failed: Setting attribute metadata::gedit-position not supported
(gedit:24): dconf-WARNING **: 09:32:38.656: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
Thanks for this write-up. I was wondering if there is a way to launch Windows 10 applications from the Ubuntu bash terminal window, like starting the default Windows 10 browser. I understand it would involve some kind of bridge to launch the *.exe files from within the Linux environment. Perhaps the Windows 10 developers have integrated this “bridge”, but I haven’t been able to find any documentation for it.
Paste where? I’ve got little experience with Windows10 so I don’t understand what this is about.
Paste the shortcut in %appdata%\Microsoft\Windows\Start Menu\Programs\Startup
$ echo “export DISPLAY=localhost:0.0” >>
$ xterm
xterm: Xt error: Can’t open display:
xterm: DISPLAY is not set
echo “export DISPLAY=localhost:0.0” >>
Just creates the configuration file. You need to close bash and reopen it for the bashrc file to apply.
Hi I also get a “can’t open display ” error trying to launch VcXsrv. I have moved my “root” directory to a different folder for easy acces. Using these commands the configuration file is within said folder. Should I move .bashrc to where my WLS files are or is something else going wrong?
Thank you for this guide.
The ‘xterm’ command does not work unless it is preceded by the first line of code below:
export DISPLAY=localhost:0.0
xterm
The fancy line that begins with ‘echo’ is a convenient way to add the ‘export’ command to the configuration file named ‘bashrc’ in the user home directory. The “.” before the file name is only needed if this file is hidden.
Источник