As of 2017, Windows 10 enables to install a subsystem for running Linux kernel and applications, called Windows Subsystem for Linux (WSL). Is it perfect? No. However, it is good enough when you have to use both Operating Systems at the same time. (Otherwise, probably you’d be better off with a Linux pen-drive for the time being)
So, let’s install it!
- Go to settings → update and security →for developers and select developer mode
- Go to control panel → uninstall a program → on the left bar click on Turn Windows features on or off → mark the Windows subsystem for Linux
- Restart
- Once restarted, open the Command Window (win+r → cmd) → type bash (and enter)
The first time you do this will install Ubuntu bash on Windows, and prompt you to create a username and password (doesn’t have to be the same as the Windows one). In future times, running bash command it will simply “convert” the Windows cmd into a Linux terminal. - Update/upgrade Linux system and apps (might take a while):
$ sudo apt-get update
$ sudo apt-get upgrade
(Attention: you might have trouble loading one or more packages. Press ctrl+c if you’re sure your computer “stuck” on loading one)
Then, do the “thorough” update resolving changing dependencies and conflicts:
$ sudo apt-get dist-upgrade
Finally, remove packages that are no longer needed:
$ sudo apt-get autoremove - Now you need an X-server on Windows to run graphics. You have plenty of options (VcXsrv, Xming, Cygwin, etc). I personally like VcXsrv, which is open source and you can download here.
- Follow the installation screens and start XLaunch. My preferred options are: One Large Window, Start no client and Disable access control.
IMPORTANT: DENY ANY ACCESS THROUGH THE FIREWALL. - Leave the XLaunch window black for a while and return to your bash terminal. Install your preferred Desktop environment (e.g. GNOME, Unity, KDE, LXDE, MATE, XFCE, etc).
GNOME, Unity and KDE are perhaps the most popular Linux desktop environments, however I’d advise against using them in the Windows Subsystem for Linux because they are quite heavy and you’d possibly suffer with lagging effects.
LXDE at the moment is the most lightweight of my example options, butit comes at a cost: many of our favourite programs (I’m looking at you LibreOffice) are replaced by lighter substitutes.
I find that XFCE is a good compromise (again, this is a personal choice). To install:
$ sudo apt-get install xfce4 - Now set the output display for your Linux as the Xserver screen:
Open the bash configuration file:
$ nano .bashrc
You may use the arrow keys to go to the last line and then add:
export DISPLAY=:0.0
Exit the code writer (ctrl+x) and save the file. - Then, restart the bash configurations for the changes to have effect:
$ source ~/.bashrc - Finally, you can run your Desktop Environment. In my case:
$ startxfce4 - If you have a D-Bus session warning saying it “didn’t receive a reply”, which might cause failures in displaying graphical applications, do this on the terminal:
$ sudo nano /etc/dbus-1/sessions.conf
and replace the line <listen>unix:tmpdir=/tmp</listen> with:
<listen>tcp:host=localhost,port=0</listen>
Exit the code writer (ctrl+x) and save the file. - You’re all set, but you might want to install a few things, such as:
– Firefox:
$ sudo apt-get install firefox
– Google Chrome:
$ wget -q -O – https://dl-ssl.google.com/linux/linux_signing_key.pub
$ sudo apt-key add –
$ echo ‘deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main’
$ sudo tee /etc/apt/sources.list.d/google-chrome.list
$ sudo apt-get update
$ sudo apt-get install google-chrome-stable
– R:
$ sudo add-apt-repository ppa:marutter/rrutter
$ sudo apt-get update
$ sudo apt-get install r-base r-base-dev
(for RStudio IDE you need, within Linux, to download from website here)
– Anaconda (toolbox with many packages and stuff for Python/R):
$ wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
$ bash Anaconda3-5.3.1-Linux-x86_64.sh
– Octave:
$ sudo add-apt-repository ppa:octave/stable
$ sudo apt-get update
$ sudo apt-get install octave
Remember: every time you want to open the graphical Windows Subsystem for Linux you need first to open your Xserver (XLaunch from VcXsrv) then open the bash terminal (win+r→cmd→ bash) and call your Desktop Environment ($ startxfce4).