Archive for January, 2007

X Servers for Windows

Tuesday, January 23rd, 2007 | linux, useful tools | 2 Comments

I recently needed to connect to a remote Linux system and run some diagnostics. Normally, this involves opening an ssh session to the system in question and running various command-line tools. In this case though, there is a graphical tool which it would have been really useful to run (if you’re curious, the tool in question is Luke – a graphical tool for diagnosing problems with the Lucene Java search engine).

I usually run Linux on my desktop at work so in this case I should have been able to ssh to the system in question, and set my DISPLAY environment variable to my local desktop. Assuming the remote system allows X11 Forwarding, after that it should just be a case of typing the command on the remote system and see the command’s graphical window appearing on your local desktop.

Unfortunately, in this case, the remote system is sitting behind a Cisco firewall. To connect to it I have to use the Cisco VPN client on a Windows system (I’m aware of vpnc – a Linux Cisco VPN client but I’ve had some problems with it in the past connecting to this particular site so it’s not a viable solution here). So I’m stuck ssh’ing into the remote system from Windows using the wonderful putty ssh client. If I want to run the graphical tool on the remote system I’m going to need an X Server running on Windows.

It’s been a few years since I ran an X Server on Windows. The last time I looked, there was a bunch of commercial options including Reflection X, Exceed and X-Win32. There was also a free option from the Cygwin project. Cygwin is a collection of free software tools originally developed by Cygnus Solutions to allow various versions of Microsoft Windows to behave and feel more like a Unix system. Cygwin is a great engineering effort and does a great job of giving you a Linux-like environment on your Windows desktop – but using it involves installing all sorts of dependencies and libraries on your system. As a general rule on my Windows desktop I try to keep installed software to the bare minimum – it makes it easier to move to another system when the time comes and it makes tracking software updates and fixes less of a headache. This leaves me a bit uneasy about installing Cygwin/X – I’m sure it does a good job when installed but the prospect of having to install all those libraries put me off a little.

So I dug around on the X Window System Wikipedia page. It turns out there are a few more options since the last time I looked at X Windows servers for Windows. In particular there is the Xming server. Like Cygwin/X it is based on the current release of X, but it is a standalone application that doesn’t depend on any external libraries. This sounded like just what I wanted. The Xming home page has good notes on how to configure and install Xming, so I’ll just summarise how I got it going for my environment.

  1. Downloaded the 3 Xming packages – Xming, Xming-fonts and Xming-tools-and-clients.
  2. Installed these packages in the same order downloaded (I extracted the Xming-tools-and-clients to C:\Program Files\Xming).
  3. Started putty and enabled X11 Forwarding as described in this diagram (if you use remote X11 a lot you might want to save this to Putty’s default settings).
  4. Start the Xming server locally (either via the Xming or Xlaunch commands).
  5. Run the xhosts command from the Windows command prompt to enable access from the remote address
  • Click Start, Run… and input cmd.
  • In the command window that appears type cd \Program Files\Xming.
  • from C:\Program Files\Xming type xhost +hostname where hostname is the name of the remote system.
  • Use putty with X11 Forwarding enabled to connect to the remote host.
  • Verify that X11 Forwarding is working,
    • At the shell prompt type echo $DISPLAY and you should see it has been set by Putty.
    • Run a simple X11 command like xeyes to verify basic operation.

    If all that works, you’re all set to start your graphical commands. It worked well enough to let me get my work done. I need to take a look at ssh compression and see if that improves the speed a little. Kudos to the Xming team for putting together a nice package and some clear instructions on how to get them up and running.