Make Windows Green Again (Part 3)
Make Windows Green Again (Part 3)
Following along from importing an OpenSUSE Linux distro with Docker, now it's time to further configure your environment and get graphics support up and running.
Join the DZone community and get the full member experience.Join For Free
Welcome to Part 3 of “Make Windows Green Again.” After we discussed in Part 1 of this blog series how to get openSUSE Leap running within WSL, and furthermore in Part 2 how to fix the user environment and installing additional software, openSUSE Linux already helps you accomplish a lot with the system. However, running some console apps like vi, awk, Midnight Commander (mc) may be sufficient for some of us, but what about graphics support?
“Hold off for a second,” you might think. Linux and graphics, really? “Most definitely” would be my answer. And here I’m not really thinking of gimp (for which a Windows version is in existence anyway) yet, but a proper console/terminal application to begin with; other than the Windows 10 supplied bash. Admittedly, the latter one already allows to use shortcuts like “CTRL+R” for searching through the command history, “ESC .” for printing the last argument of the command that was executed earlier (if you typed “ls -la + ENTER” then “ESC .” will add “-la” to your current command line), “CTRL+L” to clear the screen, and many more. But if we want to have a real Linux terminal, we want to use something like xterm, eterm, and the like.
Unfortunately, the Windows and Linux graphics systems are not compatible right away. That’s not a problem because the Linux graphics system is Open Source and smart people made it available for Windows too. In order to run graphical Linux applications on Windows, we’d need to install a so-called “X Server” for Windows. I’m using the Xming X Window System Server for Windows (https://sourceforge.net/projects/xming/) but with your favorite Internet search engine, you’ll find plenty of other ones. When using a different one, you’d need to be careful as setup might be different from my step by step guide when using Xming.
- Navigate to https://sourceforge.net/projects/xming/ and download Xming (currently version 6.9.0-31)
- Locate the downloaded setup file and double-click to start the installation (I’m using default options when asked for)
- Confirm that you want to start Xming at the end of the installation
If everything went fine you should see a new tray icon and when hovering over with the mouse pointer it shows important information we need to provide to openSUSE inside WSL. So make note of that, most importantly are the numbers “:0.0” (or simply take the below screenshot if my information is identical to yours).
Before moving forward we better configure Xming using the tool XLaunch. The reason is that I like to ensure that Xming is always started when my Windows starts. So let’s run XLaunch (Windows Key, type "XLaunch" and hit ENTER) and click through all settings without any change. At the end click the “Save Configuration” button and save the configuration to the Desktop. As the next step, follow the instruction of this link. Although it’s a description for Windows 8.1, it is working with Windows 10 too.
Finally, there are only two things left to configure in openSUSE, so start it up (Windows Key, type “bash” and hit ENTER) and enter those two commands:
~$ echo "export DISPLAY=:0.0" >> .bashrc
(This command tells the openSUSE Linux to use the “:0.0 display” upon startup, which is provided by Xming)
sudo zypper install xterm
(In order to have xterm installed, confirm with Y)
Now close the SUSE bash, open it again and type “xterm.” The xterm application window should now appear on your Windows 10 desktop. Isn’t that cool?
You can now install and use any graphical tool that comes with openSUSE. Let me know in the comments which are the ones you tried out.
In the next part of this article, I’m going to discuss a bug (and a potential solution to fix it) which we found within WSL. It’s going to be quite technical (we are going to use tools like strace and gdb), but certainly interesting for everyone out there who’s wondering about the details behind the curtain.
Published at DZone with permission of Hannes Kuhnemund , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.