User Tools

Site Tools


other:win10wsl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
other:win10wsl [2018/11/16 15:36]
jypeter [Installing an X server]
other:win10wsl [2019/03/18 10:50] (current)
jypeter [Opening a terminal]
Line 27: Line 27:
 | After [[#​updating_linux|updating Ubuntu]] |  1.14 Gb  |  31054  |  4947  | | After [[#​updating_linux|updating Ubuntu]] |  1.14 Gb  |  31054  |  4947  |
 | After adding some [[#​adding_useful_packages|Useful packages]] |  1.47 Gb  |  35918  |  5108  | | After adding some [[#​adding_useful_packages|Useful packages]] |  1.47 Gb  |  35918  |  5108  |
 +| After updating from 16.04 to 18.04\\ and running ''​do-release-upgrade''​ |  1.75 Gb  |  40043  |  5872  |
  
 ===== After the installation ===== ===== After the installation =====
  
-Once you have completed the installation steps, you'll get a Ubuntu machine, with a //root// and user account (preconfigured to use //sudo//) and lots of pre-installed applications (but no graphics). ​If you want to open a terminal, just select //Ubuntu// from the Start menu, and you'll get a bash terminal running inside a regular Windows ''​cmd''​ program+Once you have completed the installation steps, you'll get a Ubuntu machine, with a //root// and user account (preconfigured to use //sudo//) and lots of pre-installed applications (but no graphics).
  
 +==== Opening a terminal ====
 +
 +There are several ways to open a terminal (basically a //bash// shell running inside a regular Windows ''​cmd''​ window)
 +  * select //Ubuntu// from the Start menu. You should also add it to the task bar
 +    * right-click on the Ubuntu icon -> More -> Pin to the task bar
 +  * click on the //Ubuntu// icon on the task bar
 +    * to open more windows: right-click on the Ubuntu icon on the task bar -> Ubuntu
 +  * type ''​wsl''​+''<​Return>''​ in the (Cortana) Search field on the task bar
 +
 +=== Copy/paste in the terminal ===
 +
 +Follow the steps in [[https://​blogs.msdn.microsoft.com/​commandline/​2018/​04/​13/​copy-and-paste-arrives-for-linuxwsl-consoles/​|Copy and Paste arrives for Linux/WSL Consoles]] and you will then be able to copy paste by using ''​Shift+Ctrl+C/​V''​
 +
 +  * The //QuickEdit mode// should already be selected by default and you can
 +    * **select** text with the left mouse button
 +    * **paste** the selected text with the right mouse button (click **twice** after a new selection)
 +  * Use ''​Alt''​+''<​Return>''​ to toggle the terminal to full screen (maybe more useful options [[https://​docs.microsoft.com/​en-us/​previous-versions/​orphan-topics/​ws.11/​mt427362(v=ws.11)|here?​]])
 +
 +If you start a graphical linux terminal (e.g. ''​xterm''​) or application (e.g. ''​emacs''​),​ the usual linux copy/paste rules will apply!
 ==== Location of the files ==== ==== Location of the files ====
  
Line 56: Line 76:
 C:              111G   ​30G ​  ​82G ​ 27% /mnt/c C:              111G   ​30G ​  ​82G ​ 27% /mnt/c
 H:              366G  138M  366G   1% /​mnt/​h</​code>​ H:              366G  138M  366G   1% /​mnt/​h</​code>​
 +
 +Read the [[other:​win10wsl#​mounting_a_network_drive|Mounting a network drive]] if you want to access remote server disks on your local network
  
 ==== Linux version installed ==== ==== Linux version installed ====
Line 96: Line 118:
  
 Full list of installed packages: {{:​other:​pkg_initial.txt|pkg_initial.txt}} Full list of installed packages: {{:​other:​pkg_initial.txt|pkg_initial.txt}}
 +
 +==== Update ubuntu ====
 +
 +<​code>​$ sudo su -
 +$ apt-get update
 +$ apt-get upgrade</​code>​
  
 ===== Getting ready for some real work ===== ===== Getting ready for some real work =====
 +
 +<note important>​We assume below that you are using the **root** account, or ''​sudo''​ when executing the ''​apt*''​ installation commands</​note>​
 +
 +==== Package management ====
  
 [[https://​www.howtogeek.com/​63997/​how-to-install-programs-in-ubuntu-in-the-command-line/​|apt-get tutorial]] if you are more used to Fedora/​RedHat ''​yum''/''​dnf''​ and //rpm// packages [[https://​www.howtogeek.com/​63997/​how-to-install-programs-in-ubuntu-in-the-command-line/​|apt-get tutorial]] if you are more used to Fedora/​RedHat ''​yum''/''​dnf''​ and //rpm// packages
 +
 +  * Install the **aptitude** package manager: ''​apt-get install aptitude''​
 +    * [[https://​doc.ubuntu-fr.org/​aptitude|details]] (fr)
 +  * Install the **synaptic** package manager: ''​aptitude install synaptic''​
 +    * [[https://​doc.ubuntu-fr.org/​synaptic|details]] (fr)
  
 ==== Installing an X server ==== ==== Installing an X server ====
 +
 <WRAP center round important 60%> <WRAP center round important 60%>
  
 Need to check the best way to do this and get the best (and not blurry...) images Need to check the best way to do this and get the best (and not blurry...) images
-  * [[https://​askubuntu.com/​questions/​993225/​whats-the-easiest-way-to-run-gui-apps-on-wsl-as-of-2018|What'​s the easiest way to run GUI apps on WSL as of 2018?]] 
   * [[https://​token2shell.com/​x410/​|x410]] Commercial X server that looks promising   * [[https://​token2shell.com/​x410/​|x410]] Commercial X server that looks promising
 </​WRAP>​ </​WRAP>​
  
 +  * Download and install the free [[https://​sourceforge.net/​projects/​vcxsrv/​|VcXrsv]] X server (or try the [[https://​token2shell.com/​x410/​|x410]] or [[https://​mobaxterm.mobatek.net/​|MobaXterm]] commercial servers)
 +    * Warning: dont' forget to [[other:​win10misc#​vcxsrv_x_server|fix the compatibility settings]], otherwise the content of the X windows will appear blurry
  
-  * Download and install [[https://​sourceforge.net/projects/vcxsrv/|VcXrsv]] +  * Set the DISPLAY variable in the shell (by hand, or in the shell init file) 
-    * blurry text due to [[https://www.reddit.com/r/bashonubuntuonwindows/comments/​7h5xru/​did_high_dpi_break_for_anyone_else_lately/|wrong dpi]]? Screen size in xdpyinfo also seems wrong +    * ''​export DISPLAY=localhost:0.0''​ 
-      check [[https://​gist.github.com/​stowler/​9921780|options]]?​+    * <wrap em>​Warning!<​/wrap> ''​export DISPLAY=:0.0''​ will also work for using graphical windows locally, but will fail when trying to open a window on a remote computer, with a ''​connect ​/tmp/.X11-unix/X0: No such file or directory''​ error message ([[https://unix.stackexchange.com/questions/57138/why-does-my-x11-forwarding-attempt-fail-with-connect-tmp-x11-unix-x0-no-such/|source]]) 
 +  Need to determine if/when ''​export LIBGL_ALWAYS_INDIRECT=1''​ is useful 
 +    * it breaks ''​glxgears''​ with x410
  
-<wrap hi>Next => Check the rest of [[https://​github.com/​QMonkey/​wsl-tutorial|wsl-tutorial]]</​wrap>​ +  * TODO Next 
-==== Updating Linux ==== +    * Check the rest of [[https://​github.com/​QMonkey/​wsl-tutorial|wsl-tutorial]] 
- +    * Check [[https://​askubuntu.com/​questions/​993225/​whats-the-easiest-way-to-run-gui-apps-on-wsl-as-of-2018|What'​s the easiest way to run GUI apps on WSL as of 2018?]] 
-<​code>​$ apt-get update +    * https://​token2shell.com/​howto/​x410/​opening-linux-terminal-directly-from-file-explorer/
-$ apt-get upgrade</code>+
  
 ==== Adding useful packages ==== ==== Adding useful packages ====
  
 <​code>​$ apt-get install gcc libglu1-mesa mesa-utils libsm6 x11-apps <​code>​$ apt-get install gcc libglu1-mesa mesa-utils libsm6 x11-apps
-$ apt-get install xterm</​code>​+$ apt-get install xterm 
 +$ apt-get install emacs25 
 +# The packages below are useful for dealing with climate data 
 +# in netCDF files (and are also requirements of CLIMAF) 
 +$ aptitude install imagemagick nco cdo netcdf-bin ncview exiv2</​code>​ 
 + 
 + 
 +===== Updating WSL and ubuntu ===== 
 + 
 +==== WSL ==== 
 + 
 +WSL is automatically updated when Windows 10 is updated 
 + 
 +[[https://​docs.microsoft.com/​en-us/​windows/​wsl/​wsl-config#​managing-multiple-linux-distributions| WSL command line options]] 
 + 
 +==== Updating ubuntu ==== 
 + 
 +The ''​Ubuntu **16**.04.3 LTS''​ that was initially installed from the //Windows Store// when the test computer was running ''​Win 10 1709''​ was automatically updated to ''​Ubuntu **18**.04.2 LTS''​ when the computer was updated to ''​Win 10 1809''​. 
 + 
 +<​code>​$ lsb_release -a 
 +No LSB modules are available. 
 +Distributor ID: Ubuntu 
 +Description: ​   Ubuntu 18.04.2 LTS 
 +Release: ​       18.04 
 +Codename: ​      ​bionic</​code>​ 
 + 
 +We also ran the ''​do-release-upgrade''​ command to complete the upgrade (from 16.04 to 18.04) [ [[https://​doc.ubuntu-fr.org/​migration|more info]] ] 
 + 
 +An we then ran the usual upgrade commands. These commands can be run any time for updating the installed packages 
 +<​code>​$ sudo su - 
 +$ apt-get update 
 +$ apt-get upgrade</​code>​ 
 + 
 +Full list of the resulting {{ :​other:​pkg_190221.txt |installed packages}}, generated with 
 + 
 +<​code>​$ dpkg --list >$ dpkg --list > /​mnt/​h/​Scratch/​jypeter/​pkg_190221.txt 
 +$ wc -l /​mnt/​h/​Scratch/​jypeter/​pkg_190221.txt 
 +578 /​mnt/​h/​Scratch/​jypeter/​pkg_190221.txt</​code>​ 
 + 
 + 
 +===== Advanced configuration ===== 
 + 
 +==== ssh, agent and keys related questions ==== 
 + 
 +=== ssh from WSL === 
 + 
 +  * //dsa// ssh keys are disabled by default (becoming obsolete). ssh will ask for your password even if you have a ''​~/​.ssh/​id_dsa''​ file. ''​ssh -v''​ will print ''​Skipping ssh-dss key /​home/​jypeter/​.ssh/​id_dsa - not in PubkeyAcceptedKeyTypes''​. The solution is to use the user config file to authorize dsa ([[https://​unix.stackexchange.com/​a/​247614|source]]) 
 +    * Add ''​PubkeyAcceptedKeyTypes +ssh-dss''​ to ''​~/​.ssh/​config''​ 
 +    * Make sure the config file has the correct access rights: ''​chmod 600 config''​ 
 +  * It's not possible to add a key to ssh-agent. '​ssh-add'​ will print ''​Could not open a connection to your authentication agent''​ 
 +    * type ''​eval `ssh-agent -s`''​ (or ''​eval $(ssh-agent)''​) before using ''​ssh-add''​. Unfortunately,​ the key is stored only for the current terminal (and the other windows started from this terminal) 
 + 
 +=== ssh to WSL === 
 + 
 +Need to find a way to ssh from the Win10 part of the machine to the WSL part, and from outside the machine to the WSL part 
 + 
 +[[https://​www.google.com/​search?​client=firefox-b-d&​q=wsl+ssh|Google search: wsl ssh]] 
 + 
 +  * https://​gist.github.com/​dentechy/​de2be62b55cfd234681921d5a8b6be11 
 +  * https://​www.illuminiastudios.com/​dev-diaries/​ssh-on-windows-subsystem-for-linux/​ 
 + 
 + 
 +==== emacs configuration ==== 
 + 
 + 
 +==== Mounting a network drive ==== 
 + 
 +Read [[https://​blogs.msdn.microsoft.com/​wsl/​2017/​04/​18/​file-system-improvements-to-the-windows-subsystem-for-linux/​|File System Improvements to the Windows Subsystem for Linux]] for details 
 + 
 +<​code>​$ sudo su - 
 +$ mkdir /​mnt/​scratch01 
 +$ mount -t drvfs '​\\dfshost\dfs\scratch01'​ /​mnt/​scratch01
  
-TO DO +$ umount ​/mnt/scratch01 # When you are finished<​/code>
-  * [[https://www.emacswiki.org/emacs/​CategoryWSL|emacs]]+
  
  
other/win10wsl.1542379013.txt.gz · Last modified: 2018/11/16 15:36 by jypeter