Running Linux applications on Windows – over the network with Xming

I always find it interesting to
see clothes and accessories that were in fashion 30 years ago, make it back
into the mainstream. It seems like the computer industry also goes in cycles
every now and then.

Back in the early days of
computing – before the dawn of the glorious PC era – there were few powerful
servers that were accessed by dumb terminals. The emergence of the IBM PC
changed all that and eventually led to the rich clients that most of us have
under our desks today. The traditional PC desktop however causes quite a bit of
management overhead – especially in large organizations – which appears to be
leading to the re-emergence of “dumb” terminals that access a powerful – well –
terminal server. Only this time we have a fancy user interface.

xming_terminal_vt100.jpg
xming_xdm.jpg

If you have worked with Unix-like
operating systems before, then you’re probably familiar with the X windows
system
, though most people don’t know about the X Windows system’s (from now on referenced to as X11) network
transparency
. In essence, you can run
an application on host A, but
actually display and interact with the application on host B. Furthermore, you can actually utilize X11 to remotely log into a
host running X11 without the need to install additional software on that host –
provided that X11 is configured to support this. The screenshot below shows this a bit better.So what does this mean in
practice? You can install a resource-hungry application on a dedicated and
powerful Linux host, yet run and execute the application on a different, less
powerful Linux machine – even if that machine is not even running Linux. What’s
even better is that those remote applications appear just like any other
application on your desktop. Citrix calls this “application publishing”, and
Microsoft introduced “TS RemoteApp” with the Windows Server 2008 platform. Yet,
X Windows has offered this functionality for decades – from the very start.

But what makes this feature
really interesting for us windows admins (or Unix admins that, for whatever reason, have to use a Windows workstation), is the fact that you can install an X
server on your windows machine and run Linux applications “natively” on it
– thanks to the open-source project Xming).

Xming, according to the project
web site, is the “leading free unlimited
X Window Server for Microsoft Windows® (XP/2003/Vista)
”. There have been
security concerns in the past when using X11 remotely, but by tunneling X11
traffic through SSH, Xming is actually quite secure and doesn’t usually require
any configuration changes on the host running X11 (phew!).

When tasked with either cross-platform
system administration or development, the discovery of Xming opens up a door of
possibilities. For example, you can edit remote configuration files
conveniently by running your favorite Linux editor on your Windows desktop, or
run a terminal like gnome-terminal. Why run a terminal through X-Windows when
you can just use an SSH app like PuTTY? For one thing, you can launch GUI
applications directly from the terminal (e.g. ‘gedit &’) on your Windows
desktop. Of course, you can also play a Linux game on Windows that way.

If you’re a cross-platform
developer, then you can execute a Linux/Unix development studio (e.g. eclipse)
on your Windows box – and it appears just like any other Windows app. And since
it’s technically running on the Linux box, compiling on your Windows app really
compiles it on the remote platform (e.g. Linux). The responsiveness of applications is also quite good, at least over an Ethernet connection.

This technique also works for
multiple end users, so it’s also possible to connect to one Linux machine from
multiple Windows machines and run Linux apps. The Linux machine really acts
like a terminal server in this case.

Let’s look at how to run a Linux
app on a Windows desktop. I used Ubuntu 8.10 and installed Xming on a Vista laptop. So, download & install the following Xming
packages from http://sourceforge.net/project/showfiles.php?group_id=156984:

  • Xming
  • Xming-fonts

Then, start XLaunch from the
start menu and select the following options:
 

  1. Multiple Windows
  2. Start a program
  3. Start program: Enter the application you want to
    launch there. E.g. gnome-terminal,
    gedit, mahjongg
    or whichever remote application you want to run
    “locally”
  4. Run remote – using PuTTY: Select this option and
    specify the computer name, user name and password.
  5. On the next step, simply leave the default options in
    place, click “Next” and “Finish”.

xming_xlaunch.png

You should now have a little X
icon on the tray, and the application you selected should be running on your
desktop. The screenshot below shows gnome-terminal and gnome-text-editor
running on my Vista machine.

xming_desktop.jpg

Xming uses plink.exe (see also: https://www.eventsentry.com/blog/2007/12/plink-or-issuing-ssh-command-o.html)
internally to execute apps, whose display is then redirected to our local Windows
client, on the remote host. You can also save these settings in a configuration file and create a shortcut on your desktop or start menu.

If the XDMCP protocol is enabled
on the Linux/Unix host (disabled by default on most distributions for security
reasons), then you can log into the remote host for a complete remote session
similar to VNC or other remote desktop applications. But again, keep in mind
that XDMCP transmits data in clear text over the wire (using both TCP and UDP),
and as such is an insecure protocol that should only be enabled in trusted
networks. To log in remotely with Xming, select the following options after
starting XLaunch:

  • One Window
  • Open session via XDMCP
  • Specify the remote host name

xming_xlaunch_xdmcp.pngOne last tip regarding Xming: If, at some point down the line, you are unable to launch remote apps on your desktop, even though the X tray icon from Xming is present, then try to reset the X server by right-clicking the tray icon and choosing “Exit”.

Well, I hope this gives you a
starting point and helps ease the pain when maintaining heterogeneous network
environments.

Until next time,

Ingmar.