16 ms·
WSL2 – Installation Tutorial for Graphical Windows Subsystem on Linux
- jug 6y agoI was a little confused about the broken heart emoji in the title. I kept hunting for the big "... all this sounds fine and dandy BUT..." but think it was just a small mistake.
- 29athrowaway 6y agoI use Linux directly.
- 2OEH8eoCRo0 6y agoMe too. Using WSL 2.
- 29athrowaway 6y agoI do not use Windows, not even in a VM. I do not care at all about Active Directory, it is the wrong solution for the wrong problem anyways. I also wont be a victim of stupid ransomware or forced updates any time soon. I also don't support Windows for any of the software I create and would turn down any job if using Windows was a requirement. They are all usually low paying jobs that I do not care about.
- gjsman-1000 6y agoNote to readers: This is for the old way of running GUI Apps on WSL and is not the new, more integrated approach that Microsoft is working on and announced at BUILD.
- markawesome 6y agoUnfortunately like WSL2 and Windows Terminal, these "features" take an excessively long time.
- growse 6y agoHow long should they take?
- markawesome 6y agoThey should have been finished years ago
- eknkc 6y agoNote that this uses an x11 server on windows and simply setting it as the DISPLAY. It works but I found things to be slow. You can use it if you must but not a pleasant experience. Apparently the integration Microsoft is working on uses RDP but with some magic or whatever to avoid tcp overhead? Maybe shared memory? I hope it turns out performant cause the x11 method is like a party trick at best.
- l00sed 6y agoI believe there is a way to connect to WSL2 using RDP instead of an X server. I think I tried this before, but for some reason my setup was laggier than just using the X server. https://www.reddit.com/r/bashonubuntuonwindows/comments/gyk8hz/wsl2_rdp_is_much_slower_than_x_server/ https://www.reddit.com/r/bashonubuntuonwindows/comments/gyk8...
- Quarrel 6y agoMicrosoft are already previewing, and getting close to releasing a wayland graphics subsystem for WSL2. It will be a big step forward from the various X server options & is looking very promising. Personally I am really liking WSL2- it has replaced an always on Linux VM for me (well, it is an always on Linux VM for me).
- TheRealDunkirk 6y ago> it has replaced an always on Linux VM for me (well, it is an always on Linux VM for me). Here's a question I've been dying to ask someone who admits this is just a VM: What makes it better than running VirtualBox or VMWare Workstation, and having a nice GUI to control the various elements of the virtualization settings?
- caspper69 6y agoIt feels like part of Windows. It may not quite be there yet, but your drives just appear, you can pipe back and forth, start programs from/within either subsystem. A VM has always felt a little cumbersome, even with all of the integrations working correctly.
- JoyrexJ9 6y agoIt's just "there", hard to explain but the fact it's a VM is completely hidden, it's so well integrated I have a hard job believing it really is a VM now. I often shutdown WSL2 completely and when I open a bash shell back into it, it just springs into life, just a couple of seconds and it's back
- l00sed 6y agoOP here, there is a doc from Microsoft that talks about the changes from WSL1->WSL2, and WSL2 IS a VM. The reason it's "better" than VirtualBox or VMWare is that it's "optimized" for Windows. Which seems like a vague way of saying it uses their proprietary Hyper-V VM. I think what you're saying is true though. If you want to have fine-tuned controls, I feel like VirtualBox is nicer. I don't actually know whether or not you can go into the Hyper-V settings and manipulate memory or vCPU at all... maybe worth investigating. https://docs.microsoft.com/en-us/windows/wsl/compare-versions https://docs.microsoft.com/en-us/windows/wsl/compare-version...
- dagaci 6y agoThat Chart, the ratio of Linux vs Windows used for web serving has remained remarkably stable for the last 20+ years despite the rapid growth, and technology churn
- Lendal 6y agoArticle did not cover the "Why" question. WSL solves the problem of using Windows while still having a fast Linux/Docker development environment always at your fingertips. I'd understand the "because it's there" argument, which is a really great reason to do just about anything. But is there any other reason why you would need to use a Linux GUI on top of Windows?
- caspper69 6y agoBecause if there is something that you can do from an actual Linux install (VM or otherwise), and not WSL, then WSL is not a complete solution, and most devs will see it as such, whether they have a pressing need to run gui apps or not. If it can't, then it's not real.
- pletnes 6y agoDefinitely. I was totally put off by wsl1 when I could apt install foo, but foo wouldn’t run because shim X was missing. For one, no haskell based apps was working in the beginning, full stop. I also had problems with git-lfs losing files somehow. I stopped using it as fast as I could hit ctrl-D.
- Tajnymag 6y agoI can think of cross-building. You could for example build a QT app and test it directly on Linux from your main Windows machine.
- moth-fuzz 6y agoPersonally, it's because Linux is a wonderful development environment that meets my needs better than windows. Plus emacs (and most linux-first editors, for that matter) is lightyears faster on wsl than on the native windows builds. The only issue is with WSL I'm limited to console apps, so if I want to build an OpenGL or Vulkan or GUI project, I have to use Visual Studio or VSCode if I want a good development experience, and even then, it's not quite as comfy. I can only hope that with better GUI support comes some kind of GPU passthrough, but a woman can only hope.
- tbronchain 6y agoI have been using the wsl2 for a while now as a primary dev environment and so far it has been a great experience. Compared to wsl1, everything from nginx to mongo, docker etc. works out of the box and isn't a pain anymore. I've had issues (loosing network until reboot) with VPNs, core isolation and something, somewhere, in the way windows was managing routes and vswitch nat. But it has been fine since the recent 2004 update. Quite surprisingly, VcXsrv works very well as well out of the box. No additional configuration to what's mentioned in the article has been needed. Running a full GUI is a bit over the top but being able to run Linux GUI apps is sometimes a must. This setup is all I've been asking for a long time and is worth trying to anyone who devs on Linux but wants to run windows as everyday OS.
- vetinari 6y agoDocker works for you? How? Is it really docker for linux, or docker for windows to which you talk via socket? All I've got trying to run docker was: System has not been booted with systemd as init system (PID 1). Can't operate. And it is right, WSL2 uses it's own init system that basically launches bash.
- raesene9 6y agoIME Docker for Windows works pretty well with WSL2. it just mounts the socket file into the WSL2 instance from the Docker instance, for most purposes it's pretty seemless. There are some oddness with things like `--net=host` as the daemon is running in effectively another VM, but for standard Docker workflows it's been fine.
- markawesome 6y agoStartup time for Docker is about 15 seconds, compared to Linux which is immediate. You're also going to get additional slowness because Docker is running inside another VM.
- raesene9 6y agoIf you're talking about time to launch a container, that's nothing like the times I'm seeing, is there perhaps a problem with your setup? time docker run -d nginx 0c65064fc675427f0d49b837f368b6d17c3b42b2aa21bf80222baeb7ed20ed2b real 0m1.556s user 0m0.018s sys 0m0.068s
- knolan 6y agoWe use OpenFOAM for a lot of our CFD needs in my University’s Engineering department. Most students have Windows laptops. When it comes to final year projects (especially in COVID times where we can’t guarantee lab access) WSL has proven very useful for getting students up and running easily enough without the need for graphical software. It’s easy to access files in \\wsl$ for ParaView etc.
- crispyambulance 6y ago> Microsoft has clean, straight-forward installation documentation for WSL and WSL2 Well... https://docs.microsoft.com/en-us/windows/wsl/install-win10#step-2---update-to-wsl-2 https://docs.microsoft.com/en-us/windows/wsl/install-win10#s... If you can't just use the latest Windows 10 version, you really need to pay attention to version, build and minor-build.
- shmerl 6y ago> Microsoft ≮3 Linux Yeah, totally considering how hostile MS gaming division is towards Linux gaming and Vulkan adoption.
- pjmlp 6y agoI am loving those Sony and Nintendo contributions to FreeBSD, Android and LLVM.
- shmerl 6y agoThat excuses MS how? MS is so big, that the left hand there doesn't know what the right one is doing. Some contribute to good things, others are toxic and spread lock-in. And their gaming division is in the later category.
- pjmlp 6y agoIt is called business, not charity.
- shmerl 6y agoIt's called those who slow down progress with their despicable "business practice". Though explaining it to you is pointless - you very consistently support lock-in and the damage it's causing, whitewashing it as "that's what industry does", as if that was ever a valid excuse.
- meddlepal 6y agoOnce Microsoft's native WSL GUI integration is in place I am probably going to abort using Fedora as my primary and just use Windows. I've been avoiding WSL because the Windows to WSL FS performance wasn't good enough but I think soon that will not be a problem. I'm just not seeing a good reason to stay Linux-native and I've been Linux-native for 10+ years now.
- deleted 6y ago[deleted]
- KarimDaghari 6y agoIn my experience, WSL2 is noticeably better than WSL1. Note that that I have an SSD w/ 32 gigs of ram so ymmv.
- meddlepal 6y agoI tried it, I work with IntelliJ primarily and the performance was painful working with Windows IntelliJ and accessing Linux files.
- foreigner 6y agoMeh, call me when Microsoft releases Linux Subsystem for Windows.
- honkycat 6y agoI've been using WSL2 for the last few months. I never thought I would see the day I prefer Windows to OSX AND Linux for a development environment, but that day has come. I am ASTOUNDED by how well WSL2 works, especially when integrated with VSCode. For a much better terminal experience, I recommend Windows Terminal. Easy to configure, works great.
- learc83 6y agoSame here except that I'm using neovim. I recently retired the Linux server I used to remotely access from my Windows desktop to do dev work on.
- pssdbt 6y agoCurious, what does Windows bring to the table that someone would prefer it over just Linux? I did the whole development with WSL2 thing for a bit, and it sort of worked OK, but then I setup dual boot and it's so much nicer to have a minimal WM / lighter OS / Windows out of the way.
- swiley 6y agoIt helps remind you to stand up and drink water every other week.
- extralego 6y agoFor me, the answer is dispiriting: Photoshop and Illustrator. There is no other way to have a standard Linux distro and Photoshop on the same workstation without some far out hacks.
- pssdbt 6y agoFor sure. For Adobe products I would be all Windows/Mac.
- shados 6y agoI can think of a few things. First, you get Windows for everything else (if you use the machine for personal stuff, gaming, need Office desktop apps, if you need Photoshop, etc). You get a lot of that on Mac though (well, less so on the gaming front, but Macs have some apps that aren't on Windows too). But that's "real" Linux, so you don't have to spend time installing GNU tooling or fighting with brew. Dual booting can get annoying, because you have to, well, reboot. You don't have to worry about hardware. Linux has come a long way, but there's still the random peripherical that doesn't work, or some where the configuration software is Windows only. It's pretty easy to avoid hardware that won't work with Linux, but in this world you don't even have to worry about that. Especially relevant in the desktop space where you have to look at every component. WSL2 also has some interesting benefits, like being able to install a couple of different distros, or wipe out and start over in a few seconds if you screw things up. It's kind of the docker experience without docker. In the corporate world, it also means not having to convince your employer to get a Linux install they'll support. The company I work for only allows Windows or Macs. Sure, I've worked at big companies where after some back and forth with IT we could get Linux on the PC machines, but it's nice not even have to go through the hoops. There's some drawbacks: interop between the WSL2 file system and the Windows one works fantastic, but it's FREAKISHLY SLOW. If you're trying to git clone a big repo or npm install a big library and you're crossing boundaries between the two system, you're not going to be happy (as long as you stay within the WSL world you're fine though). GUI apps are an issue. It's pretty easy to get most apps working using a Windows compatible X Server, but hardware acceleration is an issue. It looks like it might be possible to get working, but I sure as hell haven't been able to. The team is working on an official way to run GUI apps without going the X Server forwarding path, but it's not there yet. For now it works fine for simple things, like terminals and text editors, but trying to use Google Maps in Firefox is simply not useable (but it does work!). I'm one of those weird people who actually likes Windows, and for 99% of my development use cases, Windows + WSL2 let's me do everything I need with zero compromise, and without having to reboot all the time. I can have a Windows-only game running with my Linux terminal open to do some development while I'm waiting for a group in my favorite MMO. Docker + WSL2 is great too.
- thesis 6y agoHave they fixed the filesystem performance issues yet? My speeds were faster on WSL1 https://github.com/microsoft/WSL/issues/4197 https://github.com/microsoft/WSL/issues/4197
- derkoe 6y agoX11 connection breaks when machine goes to sleep/standby or the network changes (e.g. VPN). Until the native WSL 2 GUI support launches you can use some workarounds like Xpra or X2Go - see https://dev.to/derkoe/development-environment-in-wsl2-137l https://dev.to/derkoe/development-environment-in-wsl2-137l
- veesahni 6y agoWSL2 & VSCode have completely replaced Virtualbox/Vagrant/SublimeText for me. The WSL2 Linux VM runs on Hyper-V, BESIDE windows, not on top of it. So the VM is fast and i/o is fast. VSCode has a WSL2 plugin which enables it to operate in client/server mode with server running in Linux and client on Windows (seamless to end user). The setup works really well. I've tried the GUI approach described in this post but there's a noticeable latency in GUI apps running in the VM. Microsoft has announced a new approach they're trying out so let's see how that plays out.
- thrownaway954 6y agothe vscode remote extension is amazing. you can run your code directly in the wsl instance.
- question_guy 6y agoEver since it came out I've asking myself why is it called "Windows subsystem for Linux"?! Isn't Linux that's actually running as a SUBsystem, since Windows is the host?!
- input_sh 6y agoSome stupid rules (probably around patents) prevent them for starting the name of the project with the word Linux. Since they own the Windows brand, they can start the name of the project with that.
- minkzilla 6y agoYeah, this drives me nuts. Even if they can't use Linux at the start of the project name for copyright rules or whatever there must be another name that isn't the exact opposite of what it is.
- gruez 6y ago>According to a W3Techs survey, Unix operating systems (the under-pinning OS of Linux, as well as MacOS) make up 71% of the Web, the remaining 29% being Windows. Additionally, every Android phone, tablet and smart TV runs on a modified version of the Linux kernel. So, I guess if you can't beat 'em, join 'em? I'm not sure what he's trying to say here. unix based operating systems are gaining market share, so microsoft is adding support to stay relevant? The main problem is that most of the growth is coming from mobile/embedded devices, where the platform is so walled off to the user that it really doesn't matter whether the kernel is unix-like or not.
- deleted 6y ago[deleted]
- rubyist5eva 6y agoWhile this is interesting, WSL2 is getting suppport for graphical applications integrated right into the Windows desktop/taskbar - so unless you absolutely must have the desktop environment, this won't be necessary anymore. Good in the short term though!
- nickjj 6y agoI've been running WSL and then WSL 2 for a while now as my full time development environment, it's quite solid. This isn't mentioned in the blog post but if you use VcXsrv you can have it start up automatically by putting its config in your start up folder. That's what I've been doing here for the last year or so: https://github.com/nickjj/dotfiles/blob/master/c/Users/Nick/AppData/Roaming/Microsoft/Windows/Start%20Menu/Programs/Startup/config.xlaunch https://github.com/nickjj/dotfiles/blob/master/c/Users/Nick/... If anyone prefers video about 6 months ago I recorded https://www.youtube.com/watch?v=idW-an99TAM https://www.youtube.com/watch?v=idW-an99TAM which is about a 30 minute drive by of setting up WSL 2 + Docker + VcXsrv and a bunch of other tools that are handy on Windows for web development.