25 Sep

using vnc to create a thin client

At home, I use two computers (and have the makings of several more) for my daily net access.

One computer is a zippy 1.7GHz box which I call Monolith because of its shape and colour. The other is a 350MHz box which is slow and frustratin with anything more demanding than a simple Fluxbox window manager.

Usually, the big zippy monster is used by Bronwyn for email, which seems like a huge waste of processing power.

Yesterday, I decided to even the score, and create a thin client out of the slow one, which would apparently speed it up, and give some other benefits as well, which I’ll get to.

So – what is a thin client? A thin client is a computer with very little computing power, which uses an application server to run all the programs wanted.

Monolith on left running KDE3.2 on x.org6.7. Methuselah on right running KDE3.3 on VNC

I was thinking about this on the way home, and figured there were two ways to do this – I could either run some programs on the server, sending the visuals back via X’s network, or I could run all programs on the server. I opted for the second.

There was very little involved in setting up the server.

  • Download and install a vnc server.
  • Run vncpasswd ~/.vnc/passwd to set up the VNC server’s access password.
  • Edit /etc/sysconfig/vncservers and add an entry for yourself, using the example as a template.
  • You can now either restart your machine and let the machine start up the server automatically, or start the vncserver by hand without restarting. I started the server with vncserver :1 -geometry 1024x768.

The client setup took just a little more thought, but was also easy.

  • Download and install a vnc client and the vncpasswd utility (comes in vncserver packages).
  • Run vncpasswd ~/.vnc/passwd so you are not asked for a password when accessing the server. Make sure you enter the same password as you used above!
  • Edit ~/.xinitrc and clear out anything that’s there, replacing with this:
    vncviewer monolith:1 -geometry 1024x768 -passwd ~/.vnc/passwd
    Make sure you replace “monolith” with your own server name.
  • Edit /etc/inittab and change the id:5:initdefault: line to id:3:initdefault:. This makes the client reboot in text mode.
  • Either shut down the X server if you can, or restart the client if you can’t.
  • Log in, and type startx. That’s it!

Now, what’s happening is that the client doesn’t bother loading up any resource hogging window managers, but instead uses VNC to directly display the output from the server.

I’m not sure of the limitations, bandwidth-wise, but I’ve run full-screen video over a standard 100M LAN with no problems.

The benefits of this, that I can think of, straight off:

  • Less expense – you only need one fast computer to run a few clients.
  • I’m not certain about this, but I would guess that a lot of programs can use shared memory, meaning that there is less computational drain to run a few instances of the same applition on one machine than to run the same number on separate machines.
  • Upgrading the server upgrades all the clients at the same time.
  • There are a lot of very cheap second-hand computers being sold by refurbishment companies! I would guess you could get a perfectly functional thin client for about 50 euro or so.
  • If the thin client can handle some extr computation, then you can use it to run small servers – email, web, database, etc, letting you decentralise your system.

%d bloggers like this: