mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-12-24 17:34:39 +00:00
223 lines
17 KiB
HTML
223 lines
17 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>CUCC Expedition Handbook: Windows expo laptop</title>
|
|
<link rel="stylesheet" type="text/css" href="/css/main2.css" />
|
|
</head>
|
|
<body>
|
|
<h2 id="tophead">CUCC Expedition Handbook - Windows Bulk Updates</h2>
|
|
|
|
<h1>A Windows Bulk Update laptop</h1>
|
|
|
|
<p>First read the generic instructions for all the software installations you will need:
|
|
<br>
|
|
<a href="basiclaptop.html">Setting up a basic Expo laptop</a>
|
|
<br>
|
|
<a href="surveylaptop.html">Setting up a 'survey laptop' for Expo survey processing</a>
|
|
</p>
|
|
|
|
<p>Unlike a Linux machine, on Windows there are two distinct levels of 'bulk update laptop' capability:
|
|
<ol style="list-style-type:decimal-leading-zero; line-height:130%">
|
|
<li> <a href="#keys">Keys and key management</a>, simple file transfer, <em>scp, ftp</em>
|
|
<li> <a href="#rsync">Synchronisation of entire file heirarchies</a>: installation and use of <em>rsync</em>
|
|
</ol>
|
|
<h2 id="keys">Level 1 - Windows Bulk Update</h2>
|
|
<ul>
|
|
<li><a href="#well">Things that already work well with any Windows laptop</a><br />
|
|
- Editing the handbook webpages, typing up SVX files and transcribing the logbook, <br />
|
|
- Anything where the file-transfer to the expo server is via the git version control software
|
|
<li><a href="#problems">Things that cause problems</a><br />
|
|
- filenames and unintentional duplication because links are not understood by Windows,<br />
|
|
- sFTP or scp for more than a handful of files
|
|
<li><a href="#problems">Things that are really hard</a><br />
|
|
|
|
- large-scale updating of several folders at once on expofiles without overwriting other people's work <br />
|
|
- well not "hard" exactly, but complicated with lot of steps that are easy to get wrong and with poor feedback as to whether you have done each step correctly.
|
|
<br>- That is what you ned a <a href="#rsync">Level 2 machine</a> for.
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h3>Software</h3>
|
|
<ul>
|
|
<li>Key management, either PuTTY or OpenSSH. You need one of these to generate and to use ssh keys on Windows. Otherwise none of git, scp, ftp (or rsync) will work.
|
|
<ul>
|
|
<li><a href="https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview">OpenSSH for Windows</a> is new (fully working since 2021). <br>
|
|
- Use the Microsoft documented install method which puts the executables in <var>windows\system32\openssh\</var>.
|
|
<br> See also <a href="https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview">https://learn.microsoft.com/... openssh_overview</a>
|
|
<br>
|
|
- We need a volunteer to produce documentation on installing and using <a href="https://medium.com/swlh/installing-openssl-on-windows-10-and-updating-path-80992e26f6a1">OpenSSL/Windows</a>. Currently all our Windows documn. used PuTty and all our Linux documentaiotn uses OpenSSL. See also <a href="https://think.unblog.ch/en/how-to-install-openssl-on-windows-10-11/">how-to-install-openssl-on-windows-10-11/</a>.
|
|
<br>
|
|
- We haven't got documentation for using OpenSSL with Filezilla yet. Please write it if you do this.
|
|
<br> OpenSSL integrates well with Github for Windows. <br>
|
|
<li><a href="../putty/putty.html">PuTTY</a> It includes command line tools ssh, scp
|
|
(pscp) and sFTP (psftp). The <a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html">PuTTY</a> installation includes puttygen and pagent which you also need. Version 0.77 was released on 2022-05-27.
|
|
</ul>
|
|
<li><a href="https://desktop.github.com/">GitHub Desktop for Windows</a> - yes this works with the expo server git even though we don't use GitHub itself for expo software.
|
|
<li><a href="https://code.visualstudio.com/">VS Code</a> is a free (but not FOSS) editor with in-built git capability and plug-ins ("Git History",
|
|
"GitLens") which render git branches graphically. Also available for Linux.
|
|
<li><a href="https://gitforwindows.org/">Git for Windows</a> - not as simple to use as it looks
|
|
<li><a href="https://www.gitkraken.com/">GitKraken</a> - Very pretty GUI interface to git, also Linux version.
|
|
Times-out for our server unless you buy it but free for university people.
|
|
<li><a href="https://winscp.net/eng/download.php">WinScp</a> can be used as an alternative to Filezilla if you like (like Filezilla, it uses PuTTY ssh keys). It has a <a href="https://winscp.net/eng/docs/screenshots">GUI</a> similar to Filezilla
|
|
|
|
<li><a href="https://www.java.com/en/">java</a> - needed for GPSprune and CaveConverter. Has to be <a href="https://www.java.com/en/download/windows_manual.jsp?host=java.com&locale=en-GB">installed separately</a> on a Windows machine.
|
|
<li><a href="https://notepad-plus-plus.org/">Notepad++</a> or any other syntax-highlighting code editor for HTML and python. We have a syntax-highlighter
|
|
to colourize .svx files, download it: <a href="/site_media/survex.xml">survex.xml</a> (no dark-mode yet though).
|
|
|
|
</ul>
|
|
<h4>Visual Studio Code editor</h4>
|
|
<p>If you use VS Code here are some relevant extras.
|
|
Not really for beginners but here are <a href="https://docs.microsoft.com/en-gb/learn/modules/python-install-vscode/">instructions for
|
|
configuring it for python</a>.
|
|
On Windows you run VS Code as a Windows app but it communicates directly ("remotely") with the WSL Linux environment.
|
|
<p>You will definitely want the
|
|
<a href="https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory">"Git History" extension</a>
|
|
and probably the "GitLens" extension too.
|
|
<p>It is entirely feasible (and on a slow machine, recommended) to use VS Code only for git management, and using a faster Windows-native editor,
|
|
such as Notepad++, for actually editing code and text.
|
|
|
|
|
|
|
|
|
|
<h2><a name="configuration">Configuration</a></h2>
|
|
<p>Brendan wrote a guide to using puTTY and git for expo on a Windows machine. It's worth reading and it has lots of screenshots: <a href="/expofiles/documents/idiots-guide-expo-git.pdf">Idiots guide to accessing expo git.pdf</a>.
|
|
|
|
|
|
<h4>Key management and configuration</h4>
|
|
|
|
<p>You need to <a href="keyexchange.html">register a key with the expo server</a> to get upload (i.e. read/write) access. Do this first, Without it none of git, scp, ftp (or <a href="#rsync">rsync</a>) will work.
|
|
You can do this entirely on your own if you have access to the <i>expo laptop</i> to upload and install the public key generated by your laptop.</p>
|
|
|
|
<p>On a Windows machine with PuTTY you will need to configure pageant (the puTTY authentication agent)
|
|
to <a href="https://blog.shvetsov.com/2010/03/making-pageant-automatically-load-keys.html">run at startup to load your key</a>. Note that you are loading your <em>private</em> key, the .ppk file, into pageant and that this key never leaves your laptop.</p>
|
|
|
|
|
|
<p>Full illustrated instructions:<img src="https://wiki.filezilla-project.org/favicon.ico" width=64 hspace="20" align="right"></p>
|
|
|
|
<ul>
|
|
|
|
<li><a href="../putty/putty.html">Installing puTTY on Windows</a>.</li>
|
|
<li>Read the online instructions about using <a href="https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement">OpenSSH key management</a> (several webpages). (Then write them up and edit this handbook to be more useful.)
|
|
|
|
<li><a href="fzconfig.html">Installing Filezilla</a>.</li>
|
|
|
|
</ul>
|
|
<p>The above gets the command-line puTTY tools (ssd, sftp, pscp) running.
|
|
|
|
<p>Most Windows software that we recommend "just works" if you have set up puTTY and have done the <a href="keyexchange.html">key-pair setup</a> and are running a local ssh agent (pagent) automatically at boot up on your laptop.
|
|
<p>Some software (such as Filezilla) defaults to using pageant and it "just works".
|
|
|
|
|
|
<p>When using Windows please, please be <a href="http://expo.survex.com/handbook/survey/getin.htm#filenames">excessively careful when naming files and survex names</a>.
|
|
|
|
<h4>Configuring Filezilla or equivalents</h4>
|
|
<ul>
|
|
<li><a href="fzconfig.html">Installing Filezilla</a>.</li>
|
|
</ul>
|
|
<p>Filezilla defaults to using pageant and it "just works" if you used PuTTy.
|
|
|
|
|
|
|
|
<h4>Configuring git</h4>
|
|
<p><a href="/expofiles/documents/Idiots guide to accessing expo git.pdf">Idiots guide to setting up git for expo</a>
|
|
- PDF - Brendan's guide. Uses puTTY and GitKraken on WIndows. Read this, but most people will need to use VS Code instead of Git Kraken.
|
|
|
|
<p>Some software, such as the commercial (but free) GitKraken, requires that you click a checkbox to say that you are "using local SSH agent" rather than specifying ssh private keys explicitly (File->Preferences->Authentication in GitKraken).
|
|
|
|
<h3 id="problems">Things that cause problems</h3>
|
|
<h4>Filenames</h4>
|
|
<p>Linux allows characters in filenames which Windows doesn't. There are also apparently normal filenames which Windows rejects (such as "<a href="https://answers.microsoft.com/en-us/windows/forum/windows_7-files/why-cant-i-create-a-folder-with-name/23c86662-4988-4c7d-9c2d-3e33d4413de3">CON</a>") for historical reasons. Linux filenames are case-senstitive and Windows filenames aren't: beware.
|
|
|
|
<h4>Symbolic links and file-transfer</h4>
|
|
<p>Linux people like to use <em>links</em>. This is where there is really only one file, but it is referred to by different names. This is particularly useful when a file is moved, but you want people who have got the old location to still be able to find it. This happens quite a lot when updating handbooks.
|
|
<p>
|
|
The links you are most likely to come across are that what looks like
|
|
<span style="font-family:monospace; size=x-small; background-color: lightgray">/home/expo/expoweb</span> is really just a link to the folder <span style="font-family:monospace; size=x-small; background-color: lightgray">/home/expo/repositories/git/expoweb</span>, <br />
|
|
and that
|
|
<span style="font-family:monospace; size=x-small; background-color: lightgray">expoweb/essentials.gpx</span>
|
|
is a link to the file <span style="font-family:monospace; size=x-small; background-color: lightgray">/home/expo/expofiles/gpslogs/essentials/essentials2019.gpx</span>
|
|
<p>But that example is in the <span style="font-family:monospace; size=x-small; background-color: lightgray">:expoweb:</span> repository, so you won't be using sFTP to download it. Instead you will be using the version control software which handles it without problems. But we use it as an example of what to look out for when using sFTP.
|
|
|
|
<p>
|
|
<img src="fzlink.jpg" align="right">
|
|
There are two types of linux links: hard links and symbolic links. Symbolic links are much the same thing as Window's "Shortcuts" but there is no equivalent on Windows to Linux hard links. Fortunately we don't <em>seem</em> to have any hard links anywhere.
|
|
|
|
|
|
<p>What really makes things unpleasant is that sFTP software won't tell you when it comes across a link and will just do something stupid. Our recommended sFTP software - Filezilla - is guilty of this,as it pftp (puTTY) working in eith sFTP or scp mode.. So what happens is that when you download a load of files onto your laptop using Filezilla it will simply turn every link it finds into a complete copy of the file. Then when you upload those files to the server, the copied file overwrites the link. So the server now has two files with the same content - which is a maintenance nightmare. This is painfully stupid because if it is a symbolic link there is no reason why Filezilla couldn't just create a Windows Shortcut which would do exactly the same thing. But it doesn't.
|
|
|
|
<p>So the ordinary user won't notice any problems, but the nerds behind the scenes start to cuss and shout and generally carry-on in an expletive-heavy manner.
|
|
|
|
<p>What is even more irritating is that Filezilla displays an link (<span style="font-family:monospace; size=x-small; background-color: lightgray">essentials.gpx</span> in the image) with a little arrow - it knows perfectly well that it is a symbolic link (although it does display it with a folder icon) - but it downloads it as a file copy.
|
|
|
|
<h4>Symbolic links: the solution for Windows</h4>
|
|
<ul>
|
|
<li>When using the git version control systems the download of a link works fine. But be careful not to edit the link file downloaded (it is just a text file holding the path of the file holding the actual contents) because then the version control client would upload it to the server and overwrite the link on the server with something that isn't a link. It also won't work as a Windows shortcut, but at least the default behaviour isn't actively dangerous.
|
|
<li>When using sFTP, manually check whether any files you are copying from the server are links - look at the symbol in Filezilla.
|
|
<li>Be careful not to copy any links using sFTP and instead recreate them manually on the Windows filesystem using right-click "Create shortcut".
|
|
<li>You will have to find out what to make the shortcut link to by logging in to the server (using a puTTY ssh logon) and doing <span style="font-family:monospace; size=x-small; background-color: lightgray">"ls -l"</span> in the folder where the link is.
|
|
<li>But later, when re-uploading edited files from Windows to the server, Filezilla will see the Windows shortcut as a ".lnk" file which it will upload, but which will mean nothing to the linux server receiving it. So you would have to manually recreate the symbolic link by logging into the server using ssh and using the "ln -s" command. Yuk.
|
|
<br />
|
|
<li>Even if you use scp instead of sFTP, it does the same stupid thing when copying from a linux filesystem to a Windows filesystem. The puTTY package includes <span style="font-family:monospace; size=x-small; background-color: lightgray">pscp.exe</span> but even if you force it to use the scp protocol like this:
|
|
<tt>
|
|
pscp -scp expo@expo.survex.com:expoweb/essentials.gpx .
|
|
</tt>
|
|
it downloads a <em>copy</em> of the contents of essentials.gpx and not a link.
|
|
<li>A possible fix in the future might be to keep all your expo files in a separate partition of your hard disc which is formatted with a linux filesystem (such as ext4) and run the <a href="https://www.ext2fsd.com/">ext2ntfs</a> driver to mount this fielsystem read-write from Windows. Probably not a good idea as the driver is a bit flaky in read-write mode and you could lose everything.
|
|
|
|
</ul>
|
|
<h2 id="rsync">Level 2 - Windows Bulk Synchronisation with rsync</h2>
|
|
|
|
|
|
|
|
<p>When using Windows please, please
|
|
<ul>
|
|
<li>be <a href="../survey/getin.htm#filenames">excessively careful when naming files and survex names</a> and
|
|
<li>be <a href="qstart-rsync.html">exceptionally careful when using rsync</a>.
|
|
</ul>
|
|
<p><a href="https://rsync.samba.org/">rsync</a> is a Linux command-line application, so we need a terminal window to run it and a Windows client executable.
|
|
None of the packaged software (Filezilla, puTTY) includes a Windows rsync client.
|
|
<p>Windows comes with a terminal window (cmd.exe) so we 'just' need a native Windows rsync executable <var>rsync.exe</var>.
|
|
<ul>
|
|
<li>The only direct port of rsync to Windows is Cygwin: <a href="https://stackoverflow.com/questions/23517023/rsync-from-windows-to-linux-using-puttys-pagent-authentication">this</a> . <br>- You just need the following files: rsync.exe, cygwin1.dll and cygz.dll .
|
|
Read the <a href="https://ccm.net/computing/windows/3877-rsync-under-windows/">instructions</a><br>
|
|
- You will also have to install OpenSSH and configure the Cygwin system to use the OpenSSH ssh key.
|
|
<li>bash window - a different terminal window. This is installed by default when you install <A href="https://gitforwindows.org/">gitforwindows</a>. Unfortunately while this <a
|
|
href="https://en.wikipedia.org/wiki/MinGW">MINGW32</a> setup includes a command-line git executable it doesn't include rsync: you have
|
|
to excavate it yourself, see <a href="https://prasaz.medium.com/add-rsync-to-windows-git-bash-f42736bae1b3">a 2020 script</a>, alternatively <a
|
|
href="https://blog.tiger-workshop.com/add-rsync-to-git-bash-for-windows/">a 2017 recipe</a> or <a
|
|
href="https://gist.github.com/radleta/0b337a2b14f761951cf2aab0578512b9">recent experiments</a>.
|
|
|
|
<li>Or you can use WSL: Windows System for Linux<img src="wsl.jpg" align="right" hspace="10"><a href="https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux"></a>
|
|
<ul>
|
|
<li> This effectively installs a whole copy of Linux
|
|
<li>Unfortunately this does not integrate with PuTTY <em>at all</em>
|
|
<li>You will need to do the key management setup <em>again</em>, within the WSL environment.
|
|
<li> You want WSL1 not WSL2. WSL1 is 20x faster for Windows NTFS filesystems.
|
|
<li> WSL on anything other than drive C:\ may involve you with <a href="wsllaptop.html#bold">hard to diagnose file permissions problems</a>
|
|
|
|
<li>See our own expo page about <a href="../computing/wsllaptop.html">setting up a WSL Expo Laptop</a>.
|
|
</ul>
|
|
<li>A full <a href="https://www.brianlinkletter.com/installing-debian-linux-in-a-virtualbox-virtual-machine/">virtual Linux machine</a> running
|
|
using a hypervisor such as <a href="https://www.virtualbox.org/">VirtualBox</a> which has its own virtual Linux filesystem. This setup has the
|
|
disadvantage that you may not have easy access to the files from Windows.
|
|
</ul>
|
|
|
|
<p>If you just want rsync, then please try the Cygwin method first.
|
|
If you struggle with Cygwin, then you are unlikely to get any of the other methods to work either. So use Filezilla or WinScp.
|
|
|
|
<p>If you don't like Cygwin, and want to use a bash terminal environment instead of Windows cmd.exe, then try the MINGW32 method.
|
|
|
|
<p>Only install WSL if you are pretty sure that you want to use WSL for things other than rsync.
|
|
|
|
|
|
|
|
<hr />
|
|
Go back to: <a href="basiclaptop.html">Basic laptop</a><br />
|
|
Go back to: <a href="surveylaptop.html">Survey laptop</a><br />
|
|
Go on to: <a href="wsllaptop.html">Windows WSL laptop</a><br />
|
|
<hr /></body>
|
|
</html>
|