Install WSL2 and Ubuntu
After installing WSL2, you sometimes need to transfer files to Ubuntu, such as a test project. Since WSL mounts local disks, it is easy to install a graphical interface.
Install the Linux subsystem (WSL2, Ubuntu) on Windows10.
WSL2 is a command-line tool for developers, but the desktop environment can run inside WSL2, and you can use XServer (such as Xming or VcXSrv) to listen for X11 (graphics) programs in Linux. Xfce4 is a lightweight desktop environment that allows developers to use both WSL and WSL2.
Install Xfce4 Xming
Install XFCE4 using APT
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install xfce4
Copy the code
Midway if there is a problem can look at the error message to solve, such as download dependence can not afford to download and other problems.
Once Xfce4 is installed, install Xming, which is a Linux graphical program used to connect and display its graphical interface.
Download and install Xming: sourceforge.net/projects/xm…
Start Xming when the installation is complete
And then the next step
Next, select No Access Control below
Xming is listening, waiting for a connection.
Configured to monitor
We used ifconfig to find the LAN address of the virtual network adapter for the WSL2 virtual machine, 172.17.220.73, which is the network address of Ubuntu
Then, open Powershell and run the ipconfig command. You can see that vEthernet (WSL) is 172.17.208.1. This is the Windows network address of the vEthernet adapter used to communicate with the Ubuntu virtual machine
Next, add a line to the.bashrc file that tells the graphical application where to find Xming running locally. Use the Vim text editor to append the following to the last line of the file (where 172.17.208.1 is the address of the Windows vEthernet adapter), taking care not to configure it to the address of Unbunt, since Xming runs on Windows. Vim. ~ / bashrc export DISPLAY = 172.17.208.1:0
After the configuration is saved, run source ~/. Bashrc to make the configuration take effect.
Start the GRAPHICAL interface
Unbunt performstartxfce4
Xming then listens and displays the desktop
The problem
1, may not be able to start the connection Xming look at the Windows firewall, close the firewall try. 2. If you cannot connect, remember to select No Access Control when Xming starts. 3, restart the computer after the configuration of IP will change, need to modify. Bashrc, can also try to fix the IP or write scripts, I have not tried!