create account

How to do GUI Applications in Windows Subsystem for Linux by themarkymark

View this thread on: hive.blogpeakd.comecency.com
· @themarkymark ·
$27.92
How to do GUI Applications in Windows Subsystem for Linux
![image.png](https://files.peakd.com/file/peakd-hive/themarkymark/rFory9w7-image.png)

Everyone says you can't do GUI applications in Windows Subsystem for Linux (WSL), but did you know you really can?

In fact, you can even get a full X Windows session with WSL.  I'm going to show you how.

There are two ways to do this, you run individual X applications, or you can get an entire X Windows desktop.

---

# Launch X Windows Applications

This method is easiest and will allow you to run individual applications with ease.

You will first need an X Windows client, fortunately, there is a free option called [VcXSrv](https://sourceforge.net/projects/vcxsrv/).

Once you install VcXSrv, this will act as an X Server for hosting applications.

Launch the application and select the following options to start up the X Server host.

https://i.imgur.com/1SiFU7l.png

https://i.imgur.com/kAJHWlP.png

https://i.imgur.com/7V4OZiH.png

https://i.imgur.com/G8W79YN.png

Note the disable access control on the third screenshot.  You can do access control but it is a bit more complicated.

In your Linux distribution add the following line to the end of your .bashrc file.

`export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0`

You can either reboot your WSL instance or run this command in the shell as well to put it in your current session.

Let's install an X Windows application to test it.

`sudo apt install xterm`

Then just run `xterm`

https://i.imgur.com/ZUipjFI.png

---

# Run a full X Windows session.

#### Install Xfce4
`sudo apt-get -y install xfce4 && sudo apt-get -y install xubuntu-desktop`

This step will take a long time, it will install a full X Windows desktop.

Once finished, you can just run `startxfce4` to start the desktop.

While this works well and good, I'm going to show you an even better way to get a full desktop.

# Introducing xRDP

#### Install xRDP Server
`sudo apt-get -y install xrdp`

#### Configure xRDP
`echo xfce4-session > ~/.xsession`

#### Restart xRDP service
`sudo service xrdp restart`

#### Find your IP
`ifconfig | grep inet`

You do need your IP as you can't use localhost as Windows already has RDP built-in.

Hit F8 and type in "Remote" and you should see 

https://i.imgur.com/q8Jro4Z.png

<center>Type in the IP you got from the ifconfig command above.</center>

https://i.imgur.com/3nXokag.png

https://i.imgur.com/5nRxpui.png

https://i.imgur.com/eGvPipI.png

This method will perform a lot better for a full X Windows session, but I think you will be surprised at how well it actually performs.

While WSL doesn't support static IP, there are some tricks you can use to make it easier to acquire the IP. One option is using this [service](https://github.com/shayne/go-wsl2-host) to automatically update it.

While there are other options like a full Virtual Machine if you want to run X Windows, this is a great option if you want to experiment or have a few quick things you want to do.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 398 others
👎  , , , , , , , , , , , , , , ,
properties (23)
authorthemarkymark
permlinkhow-to-do-gui-applications-in-windows-subsystem-for-linux
categorylinux
json_metadata{"app":"peakd/2020.05.5","format":"markdown","tags":["linux","wsl","technology","palnet","neoxian","tutorial"],"links":["https://sourceforge.net/projects/vcxsrv/","https://github.com/shayne/go-wsl2-host"],"image":["https://files.peakd.com/file/peakd-hive/themarkymark/rFory9w7-image.png","https://i.imgur.com/1SiFU7l.png","https://i.imgur.com/kAJHWlP.png","https://i.imgur.com/7V4OZiH.png","https://i.imgur.com/G8W79YN.png","https://i.imgur.com/ZUipjFI.png","https://i.imgur.com/q8Jro4Z.png","https://i.imgur.com/3nXokag.png","https://i.imgur.com/5nRxpui.png","https://i.imgur.com/eGvPipI.png"]}
created2020-06-09 14:45:36
last_update2020-06-09 14:45:36
depth0
children3
last_payout2020-06-16 14:45:36
cashout_time1969-12-31 23:59:59
total_payout_value15.670 HBD
curator_payout_value12.247 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,979
author_reputation1,774,101,118,866,653
root_title"How to do GUI Applications in Windows Subsystem for Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,864,654
net_rshares61,779,137,862,024
author_curate_reward""
vote details (478)
@alexbalan ·
At this point I think you can just muster the courage and install Linux somewhere on  physical hardware. 😂😂😂
properties (22)
authoralexbalan
permlinkre-themarkymark-qbp6yn
categorylinux
json_metadata{"tags":["linux"],"app":"peakd/2020.05.5"}
created2020-06-10 06:49:36
last_update2020-06-10 06:49:36
depth1
children0
last_payout2020-06-17 06:49:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length108
author_reputation7,291,343,466,873
root_title"How to do GUI Applications in Windows Subsystem for Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,877,268
net_rshares0
@gikitiki ·
Once I found xRDP, I was a happy camper.    I've never played with WSL though ... so now I need to find some time to explore.
properties (22)
authorgikitiki
permlinkqbnyjf
categorylinux
json_metadata{"app":"hiveblog/0.1"}
created2020-06-09 14:50:03
last_update2020-06-09 14:50:03
depth1
children0
last_payout2020-06-16 14:50:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length125
author_reputation16,572,681,158,525
root_title"How to do GUI Applications in Windows Subsystem for Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,864,742
net_rshares0
@steemstem ·
re-themarkymark-how-to-do-gui-applications-in-windows-subsystem-for-linux-20200609t221923183z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider <a href="https://hivesigner.com/sign/update-proposal-votes?proposal_ids=%5B91%5D&amp;approve=true">supporting our funding proposal</a>, <a href="https://hivesigner.com/sign/account_witness_vote?approve=1&witness=stem.witness">approving our witness</a> (@stem.witness) or delegating to the @stemsocial account (for some ROI).

Please consider using the <a href='https://stem.openhive.network'>STEMsocial app</a> app and including @stemsocial as a beneficiary to get a stronger support.&nbsp;<br />&nbsp;<br />
properties (22)
authorsteemstem
permlinkre-themarkymark-how-to-do-gui-applications-in-windows-subsystem-for-linux-20200609t221923183z
categorylinux
json_metadata{"app":"stemsocial"}
created2020-06-09 22:19:24
last_update2020-06-09 22:19:24
depth1
children0
last_payout2020-06-16 22:19:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length778
author_reputation262,017,435,115,313
root_title"How to do GUI Applications in Windows Subsystem for Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,871,510
net_rshares0