Cygwin XServer on Windows

What is Cygwin?

  • A large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.
  • A DLL (cygwin1.dll) which provides substantial POSIX API functionality.
The homepage can be found here: https://cygwin.com

Installing Cygwin with XServer

cygwin is also available from the gsi software center.

Download

Donwload the 64-bit (setup-x86_64.exe, recommended) or 32-bit (setup-x86.exe) installer depending on you operating system architecture.

https://cygwin.com/install.html

Installation

  • Double-click the just downloaded setup executable in the explorer.
  • First you need to enter your localadmin username and password to allow the Cygwin installer to run in elevated mode.
  • When you are asked for a download source choose "Install from Internet".
  • For the Cygwin root directory I recommend something plain like "C:\cygwin". Installing it into a "Program files" folder often leads to problems with access rights later. Under "Install for" select "All Users".
  • The Local Package Directory is used as a cache for downloaded packages. Choose a location that has enough space and where the downloads can reside without problems.
  • When you have to select your internet connection choose "Direct Connection"
  • You now have to select a mirror where the packages are downloaded from. Choose a mirror close to you (ending on .de for a german one).
  • When asked to select the packages, choose under the X11 group the package xorg-server (the version might be different if you have a more recent cygwin setup) and click "Next":

    cyi01packages.png

  • On the next page select (if you want) Desktop and Start Menu items (recommended) and you are finished with the Cygwin installation

Creating a shortcut to connect to the ASL Cluster (or any other Linux X-Server with XDMCP)

To make it more comfortable you can create a shortcut that directly connects to a machine by XDMCP.
I will demonstrate this assuming that cygwin was installed in "C:\cygwin" and the machine you want to connect to is "asl730.acc.gsi.de".
If you used a different installation path you have to adjust the following instructions accordingly.
  • Right-click on you Desktop and choose "New" -> "Shortcut" ("Verknuepfung" in German)
  • Browse to "C:\cygwin\bin" and select "XWin.exe", click "Next"
  • Change the shortcut name to something meaningfull, e.g. "asl730.acc.gsi.de XDMCP" and click "Finish"
Before you are ready we have to add some command line options to the shortcut.

  • Right-click the new shortcut on your desktop "asl730.acc.gsi.de XDMCP" and choose "Properties" ("Eigenschaften" in German)
  • Modify the "Target" and add command line options to connect to a specific server:
    C:\cygwin\bin\XWin.exe :0 -query asl730.acc.gsi.de
    cyi02shortcut.png

  • Press "Ok".
During first launch the Windows Firewall asks for permission to let XWin access the network. A local administrator account is required.

Now you should be able to Double-click the shortcut and a login screen for asl730.acc.gsi.de should open:

cyi03login.png

Using the Cygwin XWin server in multi-window mode

Setup

With a little bit more effort, you can make remote applications look and feel almost like local applications. They appear on your taskbar like local applications do and blend in with them seamlessly. The speed is decent, but be warned: Your connection is not encrypted!

This description assumes that you have already completed the installation steps described above. Here's how it works:
  • Use the installation executable (setup-x86_ <32/64>.exe) to add the packages xinit, xlaunch and xhost from group X11 to your Cygwin installation.
  • Run Cygwin<64/32> Terminal as administrator (right click in start menu or <Cygwin directory>\bin\mintty.exe)
  • Edit file /usr/bin/startxwin from within the Cygwin terminal. Change the line that says listenarg="-nolisten tcp" to listenarg="" (i.e. remove -nolisten tcp, just keep the empty quotes).
  • Run Cygwin-X -> XWin Server from the start menu or C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin"
  • ​In the xterm that pops up, enter the following commands (for example):
    • xhost asl731.acc.gsi.de (to specify which hosts are allowed to connect to your X Server, specify additional ones as needed)
    • ssh asl731.acc.gsi.de (to connect to the cluster)
    • export DISPLAY=belpc123.campus.gsi.de$DISPLAY ​(replace belpc123 ​with your machine's hostname)
  • Now run an application! It should look similar to this (Eclipse and SQL Developer are running on the cluster, Notepad locally):
Cygwin_Windowed_Mode.png

Startup script

For convenience and efficiency, a script to put in your local Cygwin home directory that sets up an allowed host, connects to the cluster and configures remote displaying of applications could look like this:

#!/bin/bash
xhost asl731.acc.gsi.de
ssh -t asl731.acc.gsi.de "export DISPLAY=<your hostname>.campus.gsi.de$DISPLAY ; bash -login"

Known issues

a recent cygwin including an x server above 1.18 will not work with an xdmcp query to acc6. Reported Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1337067

-- RaphaelMueller - 08 Jan 2015
Topic revision: r9 - 13 Apr 2020, JuttaFitzek
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback