Advantages

X Windows can be used in a Server-Client relationship. By setting up your X Windows Server you allow the use of all the programs on that computer to all the client PC's.

There are many advantages of running client computers in this manner:

They don't even need a hard drive.

It's silent as there are no moving parts

The solution saves power as your computers are very thin.

Everything can be backed up centrally.

Boot times for client PC's are the fastest around.

Clients don't need much CPU speed, memory, etc. Because of this they would be very cheap. You could get away with using a Pentium 100Mhz with 32MB ram, no hard drive, no CD-ROM, no Floppy and a fanless power supply. You just need a ethernet card with a PXEBOOT ROM. (XDM mode)

Select SSH Server and NFS Server in the installation process, for the rest of the options go with the default.

NOTE: If you forget to add any of the labels above, you will have to reboot as you cannot add labels to your boot drive when you have booted off it. So boot of the installation CD and use the configure -> label option in the sysinstall screen to add these labels to your boot drive. You may need to retype the mount points for /, /var, /tmp and /usr by hitting 'm' on each label. Once you have created these labels in the 'Disklabel Editor' then you can hit 'w' to write them to the disk. answer 'yes' to the next question, hit 'ok' to the warning message. Now quit and reboot. Add them to fstab (/dev/ad0s1g /diskless_ro) & (/dev/ad0s1h /diskless_rw) and mount.

I find the best way to get this working is to break it down in to small steps and get each step working independantly. IE: Setup NFS and see if you can mount it from another FreeBSD machine, don't just assume it will work and boot your PXE-Boot machine.

Throughout my documentation

192.168.1.1 = the Server

192.168.1.2 = the client (may be a full freebsd system or pxeboot)

At this point I normally install fluxbox with the following line:

shell# pkg_add -r fluxbox-devel

change your ~/.xinitrc file to the following:

startfluxbox

Copy to .xsession

$ ln -s ~/.xinitrc ~/.xsession

Use the following command to update your fluxbox menus:

shell$ fluxbox-generate_menu

Running a single application

To get started I have my server setup running FreeBSD, with X-Windows and a few applications. Nothing too special. Then I have my client PC, which to start off I used the frenzy 1.0 boot CD to perform these initial tests. You can get this from frenzy website. I entered into fluxbox, but you could equally use any X session.
You must allow incoming connections this is done with two commands

client$ startx -listen_tcp
client$ xhost +

This allows all computers to start applications on your client PC. It's dangerous but good for testing everything is setup correctly.

Client

Your client should boot now just remember that you may get a different IP now that you are talking to a different DHCP server so you have to change your exports file and copy accross a directory in /diskless_rw for the new IP. All this is done on the X Server.

TFTP Setup

TFTP helps us transport the kernel to the PXE-Boot machines.

# mkdir /tftpboot
# cp /boot/pxeboot /tftpboot

Uncomment the following line in /etc/inetd.conf

tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot

Restart the inetd service

# killall -HUP inetd

If inetd has not started automatically do the following:

Add the following to /etc/rc.conf

inetd_enable="YES"

Now start inetd manually.

# inetd

Test

To test that tftp has loaded type the following:

# sockstat -4l | grep 69

and you should see this:

root inetd 13719 5 udp4 *:69 *:*

NFS Setup

Network File System. Here we share all the directories from the server so that the diskless clients see these drives as if those directories were the diskless client's.

Server Setup

If you forgot to select 'Yes' to NFS server setup in the FreeBSD installation then you have to setup the server manually like so:

It's very important that you copy all the files in pam.d across otherwise you will not have a password prompt on your login.

Create a fstab in /diskless_rw/<ip>/etc

# touch /diskless_rw/<ip>/etc/fstab

Setup diskless_ro

This is the common root mount for all pxe-boot clients.

Copy accross important directories and kernel from boot to diskless_ro

# cp -rv /bin /lib /libexec /sbin /boot /diskless_ro

For some client machines you may have to disable the ACPI (Power management) in the /diskless_ro/boot/device.hints

hint.acpi.0.disabled="1"

So we can use the systems /var/tmp and /usr/home directory make soft links to them

# cd /diskless_ro
# ln -s /var/tmp /usr/home

In the /diskless_ro directory make the following directories:
-dev so that clients can boot without freezing
-var so we can mount from the /diskless_rw/<client ip>/var into the var directory
-etc to store some common files

# mkdir usr dev var etc

We require a few files from the systems /etc directory to be copied into the /diskless_ro/etc for common use between the thin clients.

# cd /etc;
# cp services netconfig login.conf /diskless_ro/etc

rc file

The /diskless_ro/etc/rc file is the first file which is ran after the kernel has loaded. Here we mount a the labels from the server.

GRUB Floppy boot (optional)

(would like to compile this ourselves later)
To get started we downloaded the image from www.hp.uab.edu/~ed/grub-net

shell# dd if=/data/grub-net.img of=/dev/fd0

Then we mounted it as msdos
Remove/rename menu.1st from the grub directory as it was doing something funny with it. We think that it was looking for a tftp server through our dhcp and we don't have a the dhcp setup correctly here, so we wanted to do it manually.

X config notes

On the X server the /etc/X11/xorg.conf file is only used for the X server not the clients.

To use this same configuration for your X Terminal Clients copy this file to /diskless_rw/<Client IP>/etc/X11 and it will use it.

Starting X on the client

There are two ways of doing this and it depends on your hardware mainly.

1. run all programs on the server using the servers CPU and Memory this we will call the 'XDM Method'
2. run all programs from the NFS mounts using the clients CPU and Memory but the HD of the server, this we will call the 'NFS Method'

Both methods will boot from PXE-Boot and can be diskless.

XDM Method

Recommended for machines less than 1Ghz 256MB

This is quite simple to setup. Change your rc file in the /diskless_ro/etc directory to have this line at the end:

X -query <server ip>

Make sure on the server you setup xdm to start on system startup

# vi /etc/ttys

Search for this line:

ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure

and change it to:

ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure

You can also type this command at the command line on the client to test before hand.

NFS Method

Recommended for machines over 1Ghz 256MB or if you want to utilise any of the clients devices such as local HD, USB, CD/DVD burners, etc.

Convert an Existing system with standard mount points

If you cannot afford to create /diskless_ro and /diskless_rw then you can use /var/diskless_ro and /usr/diskless_rw instead.

Use the same notes and replace /diskless_ro with /var/diskless_ro and /diskless_rw with /usr/diskless_rw. Make sure you create these directories first.

todo

Here are some of the jobs left to do to make this secure or generally better:

- There must be a simplier way to set this up if your going to use XDM in the end. IE: do we need to do half of this tutorial if we are going to run XDM.

- When the same user logs onto two seperate machines they cannot start firefox or thunderbird as it complains about being open somewhere else. This assumes you have firefox and thunderbird already open on both machines that you logged onto.

Known Issues

- Doesn't work with HP-COMPAQ-T5525 thin client as it doesn't want to boot, it says it's missing libfreetype.so.9 which we do have it just cannot find it for some reason. It's trying to use the VIA chipset for graphics which is different to all the other clients I've loaded successfully so far.

- USB mice not working instead use PS/2. If we got this working it may help get the HP T5525 working

Keyboard repeating on notebooks

- typing on some keyboards (like my notebook) causes double characters to display if you type too fast. - This is the notebook, if you go and set the KDE Accessabiltiy options and set the keyboard rate to 50ms, this fixes the problem.

USB mouse

Editing /etc/devd.conf file and searched for ums
remarked out the action line.

rebooted.

Someone off IRC suggested that I build a GENERIC xorg.conf file which has vesa, usb mouse and ps/2 mouse configurations through it.