Dan Newcome, blog

I'm bringing cyber back

Running a Linux GUI app on a headless machine

with 2 comments

We all know that several remote desktop solutions exist for Linux, the most popular being VNC. Sometimes I don’t want a full desktop login though – I just want to run a single application. Linux is able to do this by design, but we do have to install a piece of software on the client machine if we aren’t running Linux.

My scenario is as follows: I have a Dell SC40 server that hosts has some mp3s that I want to burn to CD. The server is headless — it has no monitor attached. My laptop does not have a CD burner, but the server does. The server is running the CentOS 5 GNU/Linux distrubution. The laptop is running 64-bit Windows Vista Ultimate. The CD burning software that I like to use under Linux is k3b.

Ok, so k3b is installed on my CentOS distribution, and I can use Putty to connect to the server from my laptop using secure shell. What we ultimately hope to do is to log in using Putty and simply run k3b from the commandline and have the GUI show up on the laptop. In order for the GUI to show on the laptop we need a piece of software called an X server. Since we are on Windows, this is not included with the OS so we need something like Xming.

Install Xming and run it. When Xming is running you will see an ‘X’ icon in the system tray. The default settings will do fine for our purposes here. The only tricky part is configuring Putty. We need to enable X forwarding and set the display variable to localhost:0. You’ll have to drill down to get to the setting as shown below.

Now that Xming is listening on the laptop and we have logged in to the server using Putty with X forwarding enabled, we can start any GUI app at the commanline and the GUI will display on the laptop using Xming.


# k3b

The result looks like this:

What is happening here is that the server machine is sending the X11 control commands back to the Xming software running on the laptop over a forwarded tcp port provided by Putty. It’s a little confusing unless you know how Putty and X11 work, but setting it up still isn’t too hard.

Keep in mind that any GUI application can be run this way. Another favorite usage of this technique is monitoring my server backups to CrashPlan, which offers a GUI for administering your offsite backups.

About these ads

Written by newcome

January 12, 2010 at 6:47 pm

Posted in Uncategorized

2 Responses

Subscribe to comments with RSS.

  1. Hello and thanks for the article.

    I have a question you may be able to answer. FreeNAS is running on a headless server of mine. The server does not have a video port with access to FreeNAS through a web browser (by design).

    Do you think your senario will work if I were to install Linux on my headless/videoless server?

    Like you said it is confusing how Putty and X11 work together.

    Thanks for taking my question. Regards.

    Dennis M

    March 15, 2013 at 3:18 am

  2. @dennis – your scenario should work the same even if there is no video hardware at all. As long as the application you run is able to see the DISPLAY environment variable things should work. When you enable X forwarding with Putty this gets set up for you automatically. If the app needs to have the display set explicitly it will probably be something like servername:10 where servername is the host name or IP of the machine that has the graphics hardware and the number is the display number (this is kind of arbitrary, just has to be the same on both ends).

    I haven’t had any machines that truly have no video hardware in a long time so I can’t remember if there are any pitfalls to doing this.

    newcome

    March 15, 2013 at 11:54 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: