Linux on windows 10

(this will take a couple of hours, go get some coffee)


Step 1 : Get Linux from microsoft.

Microsoft is supporting linux on windows 10 (64bit only). Use the the following guide to install linux (AKA "bash") on windows 10 :

https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

Take care with the first step in the Microsoft instructions, you must run the power shell in admin mode. Do this as follows : Go to the Windows 'Search' box (lower left) => type "power shell" (the app will appear in the list) => Right click on the app and select 'Run as administrator'.

⯈ In the second step of the Microsoft guide, use the Microsoft Store for the install. Search the store for 'ubuntu' and from the list select the one with the name "Ubuntu" (and nothing else next to it).

At the step where you create a UNIX user choose (i) a simple username (no Greek letters, no spaces, no special characters, no upper-case letters, just a plain/simple user name like 'babis' or 'toula'), and, (ii) a password that you can remember (further steps below will fail if you don't have your unix password).


Step 2 : Install a graphics environment and fonts for Linux.

Install a graphics environment for Linux by downloading and installing the following program :

https://sourceforge.net/projects/xming/files/Xming/6.9.0.31/

Also install some additional fonts by running this installer :

https://sourceforge.net/projects/xming/files/Xming-fonts/7.7.0.10/

(select all available fonts when prompted).


Step 3 : Install some extra Linux programs.

Open a linux window (search for 'bash') and verify that copy-paste is enabled as follows : Right-click on the window's title bar => Properties => Options tab => Edit options => enable QuickEdit Mode and enable Insert mode. Since you are here, change the font and font size to your liking.

⯈ Note : If you are masochistic enough to use vim as your editor, you'll probably have to use a different font so that the vim status line correctly displays the arrows, see section 4.5 below for a screenshot. The font Dejavu Sans Mono will work correctly if you have it.

Now copy-paste (and then press ENTER) the following two lines exactly as you see them (for pasting in the terminal use right-mouse-click):

wget http://utopia.duth.gr/glykos/linux/winbash.sh

source winbash.sh

Give your linux password whenever asked and watch incomprehensible lines being printed in the unix terminal. Now is a good time to refill your coffee, this may take (depending of your computer and network) several minutes if not half an hour. Don't stop it, wait until it finishes (you will see an All done message printed on the screen).

Close the terminal.


Step 4 : Test that everything works.

4.1 Initial setup

Make sure the terminal is closed.

Start (double click or search for) the Xming program you downloaded previously. Xming will run in the background, don't expect to see things happening.

Start the terminal (also known as 'unix shell' or 'bash'). You should see something similar to this :

⯈ Note : You can see a zoom-in of the images that follow with right-mouse-click and then 'View image' if you are using firefox, or 'Open image in new tab' if you are using google chrome.

alt The linux terminal

4.2 Confirm that a 3D structure viewer works

Check that various programs work. Type the commands shown in red in the unix shell (exactly as you see them) :

d               (this displays the list of files and directories in the current folder)

cd data           (this changes the current directory, the new folder is 'data')

d

rasmol dim.pdb       (this runs the program 'rasmol' using as input the file 'dim.pdb')

Click on the graphics window to make it active. Play around with the structure of the B-DNA if you want (hold down the left mouse button and use the mouse to rotate it).

alt Rasmol

When you had enough, close rasmol. Click on the unix shell to make sure it is the active window.

4.3 Confirm you can make simple plots of data

Check that a plotting program works :

cd               (this takes you back to your home directory where all your files live)

cd data

d

plot < numerical.dat     (run the program 'plot' using the data contained in the file 'numerical.dat')

Click on the graphics window to make it active, press the D key, then the S key (to filter/smooth the data) :

alt Plot

When bored enough looking at a meaningless diagram, hit the Q key to quit and then click on the terminal window to make it active again.

4.4 The friendly 'nano' editor

As usual, type the red :

cd ..             (go up one directory from the directory I was in)

d

cd progs

d

You should see the names of two files containing a program in C (test.c) and a program in perl (test.pl). Check that the nano editor works :

nano test.c         (edit the file 'test.c' using the nano editor)

You should see something like this :

alt The nano editor

You can type things if you want, and you can move around the screen with the keyboard's arrow keys. Don't bother touching or moving the mouse, these are text editors, only the keyboard matters.

When bored (like 2 seconds later), close the editor with CTRL+X (don't save the changes) and then click the unix shell to make sure it is the active window.

4.5 The horrible 'vim' editor

You can also test a dangerous, mystical and unforgiving editor called vim. If you are not determined to suffer, skip to section 4.6 below and vow to always use 'nano'.

Still here ? OK, type everything exactly as described below, or you'll never be able to exit vim :

vim test.c and you should see something like this :

alt The vim editor

Don't randomly press any keys.

vim is what is called a modal editor which means that you can't just type things into vim. If you try, you'll suffer. Don't try it. Speaking of which, did you get that coffee ?

If you want vim to behave (for a little while) like a normal editor press the key i (for insert). You'll see the status line saying 'insert' and you'll notice a color change. Now you can type things, move around with the arrow keys, etc.

Enough, stop typing nonsenses.

Exiting vim is an exercise in itself. If you want to exit vim while saving any changes you made (we don't want this now), you'll have to press the following keys in exactly this order :

<ESC>           (this gets you out of 'Insert' mode, back to 'Normal')

:             (this tells vim that you will type commands),

w q ENTER     ('w' for 'write', 'q' for 'quit', and ENTER to execute the two commands)

If you wanted to exit without saving the changes (this is what we want to do), it would be ESC, :, q, !, ENTER (the exclamation mark after 'quit' says "I know I have made changes, and I know that I don't want them saved, and I'm ready to regret it if I'm wrong not saving them").

⯈ The natural question if you've reached this far is, of course, why ? Why vim exists in the first place and why people use this horror ? The short answer is that vim is an exceptionally powerful editor that in the hands of a trained user can perform editorial feats. The trouble is that to become a 'trained' user of vim is practically a full time job.

4.6 Confirm that the programming environment works

Confirm that the programming languages 'C' and 'perl' work :

cd

cd progs

d

gcc test.c -lm       (compile using 'gcc' the program contained in the file test.c)

d

./a.out           (run the program contained in the file a.out (which was produced by gcc))

./a.out | plot -cc   (run the program again but this time feed the output to a plotting program)

Make the graphics window active, and then press the C and N keys.

alt gcc, a.out, plot

Press the Q key to quit. Finally, test that perl works :

rm a.out         (remove/delete the file named 'a.out')

d

./test.pl         (run the program contained in the file named 'test.pl')

and press ENTER to return to the shell.

alt perl


Step 5 : Normal everyday use of the unix shell

Place the icons for the bash and Xming programs on the taskbar or the desktop.

alt Icons on tray

For normal everyday use you just double-click first on Xming and then on bash and you should be set and ready-to-go.

Enjoy.