Setting Up Your Own Diskless Workstations with LTSP

By: Alexander Prohorenko
Wednesday, October 2, 2002 05:09:46 PM EST
URL: http://www.linuxplanet.com/linuxplanet/tutorials/4472/1/

The Whys and Wherefores of LTSP

It is no news flash that local computer networks are very prevalent and widely used nowdays. The most common solution, is the ubiquitous PC-as-workstations model. But once you start adding in the costs for servers plus all of the headaches of the client-server model into the mix, some organizations may be wondering if this is truly the best solution.

One alternative, particularly for companies where employees work in few sessions, could be diskless workstations (X-terminals).

Right away, the advantages of this model are clear. IT departments can economize on hard drives and on RAM. They will also not need the most powerful CPUs for each PC, since all applications will be executed on server. Beyond that, any user will be able to use his or her own configured window environment without any regard for the actual workstation on which they will be working.

There are, of course, shortcomings, too. Diskless workstation networks have rather tough requirements for bandwidth (at least 100Mbps to start), workstations might be sub-par (though a nicely recycled video card will do wonders for performance), and there will be the need to spend money on a pretty high-end network server.

There are a few popular software solutions for organization of diskless workstations in the Linux environment, but from my point of view, a good choice is the Linux Terminal Server Project (LTSP).

Readers of this article won't be getting a complete documentation of LTSP, but hopefully you will be able to take away enough of the basics to get you interested.

Installing and Configuring an LTSP Server

First of all, we need to download the software from the developer's site. Minimum packages include:

  • ltsp_core-3.0.5-0.i386.rpm - LTSP package itself
  • ltsp_kernel-3.0.4-0.i386.rpm - linux kernels for booting workstations
  • ltsp_xcore-3.0.1-1.i386.rpm - X-Windows for workstations, version 4x

If you are planning to use very old PCs, you may need to download a few additional packages with X-Windows 3.3.6 with optimization for our existing video cards.

For sound support on the workstations we will need the package ltsp_sound-3.0.1i386.tgz. But, personally, I do not recommend turning sound on unless you absolutely have to--sound will quickly chew up network bandwidth.

Also, before installing LTSP we need to pre-install dhcp, tftp-server, and nfs-utils.

So, let's begin:

rpm -ihv ltsp_kernel-3.0.4-0.i386.rpm ltsp_core-3.0.5-0.i386.rpm ltsp_xcore-3.0.1-1.i386.rpm

If you do not have GNOME pre-installed (or, to be more exact, the gdm manager), you may see the next error message:

chmod: getting attributes of '/opt/ltsp/templates/gdm_Init_Default.tmpl': 
no such file or directory

This is normal and you can ignore it.

Before the next step in the process, check the value of the environment variable PATH. You must have /sbin and /usr/sbin be included in it. If these values are not there, run the following command:

export PATH=$PATH:/sbin:/usr/sbin

Now you can execute the LTSP setup:

cd /opt/ltsp/templates
./ltsp_initialize

The following message will appear:

The Linux Terminal Server Project (http://www.LTSP.org)

About to update important system files.  If you would like
to stop and review the changes that are about to be made,
you can cancel now and look at the replacement files that
are about to be installed.
		
Press  to go on, or 'C' to cancel

Press Enter. The program will display a file list, in which you make neccessary changes:

The following files will be created/modified:

/etc/X11/xdm/Xaccess               The config file to allow remote xdm log [Y]
/etc/X11/xdm/Xservers              Config file for xdm to launch local Xse [Y]
/etc/X11/xdm/Xsetup_workstation    Sets the logo of your login window      [Y]
/etc/dhcpd.conf.example            Example config file for dhcp            [Y]
/etc/exports                       The config file for nfs                 [Y]
/etc/hosts.allow                   Configuration file for tcp wrappers     [Y]
/etc/inittab                       Config file for init                    [Y]
/etc/X11/xdm/ltsp.gif              The background logo for your login      [Y]
/etc/rc.d/rc5.d/S60nfs             Startup links for nfs                   [Y]
/etc/rc.d/rc5.d/S13portmap         Startup links for portmapper            [Y]
/etc/sysconfig/syslog              Startup info for syslogd                [Y]
/etc/xinetd.d/tftp                 Enable the tftp daemon                  [Y]
/etc/X11/xdm/xdm-config            The main config file for xdm/kdm        [Y]
	     
	     
Ready to apply the changes? ( R-Review, A-Apply, C-Cancel )

Pressing A and Enter will get you this displayed message:

The Linux Terminal Server Project (http://www.LTSP.org)

Doing the update
Xaccess.tmpl
Saving old /etc/X11/xdm/Xaccess as /etc/X11/xdm/Xaccess.1
Xservers.tmpl
Saving old /etc/X11/xdm/Xservers as /etc/X11/xdm/Xservers.1
Xsetup_workstation.tmpl
Saving old /etc/X11/xdm/Xsetup_workstation as /etc/X11/xdm/Xsetup_workstation.1
dhcpd.tmpl
Saving old /etc/dhcpd.conf.example as /etc/dhcpd.conf.example.1
exports.tmpl
Saving old /etc/exports as /etc/exports.1
hosts.allow.tmpl
Saving old /etc/hosts.allow as /etc/hosts.allow.1
inittab.tmpl
Saving old /etc/inittab as /etc/inittab.1
ltsplogo.tmpl
Saving old /etc/X11/xdm/ltsp.gif as /etc/X11/xdm/ltsp.gif.1
nfs.tmpl
portmap.tmpl
syslog.tmpl
Saving old /etc/sysconfig/syslog as /etc/sysconfig/syslog.1
tftpd.tmpl
xdm-config.tmpl
Saving old /etc/X11/xdm/xdm-config as /etc/X11/xdm/xdm-config.1

The startup configuration of this package is now complete. Let's configure the DHCP server now.

First, using your preferred text editor, edit the file /etc/dhcpd.conf.example. In this configuration file you will see an example of configuration for network 192.168.0.0/255.255.255.0. You need to change these examples to actual values used in your own network.

In the line options root-path address you will need to set the server address from which your diskless workstations will boot.

If you already have a DHCP server in your network, you will need to modify its configuration like in the example file above.

An important argument in this configuration is option log-servers. It needs to be set to the IP address of the computer where all the workstations' log files will be stored. Most likely is will be the IP address of your main server.

You will also need to pay attention to the argument host ws001 {}. The number of them should be the same as number of workstations in the network, because these are individual environment settings for each workstation. After the keyword, the host name of workstation should be set.

Next, set the IP address of each workstation, along with the file name of the kernel for each unit. For instance, the ltsp_kernel-3.0.4-0.i386.rpm package value of the file name will be /lts/vmlinuz-2.4.18-ltsp-1.

Now, execute the DHCP server with the command:

service dhcpd start

The configuration of the syslog has already been done by the script ltsp_initialize. We just need to reload it:

service syslog reload

An important and necessary requirement is a properly configured /etc/hosts file (and/or a good configuration of DNS). IP addresses, which will be allocated for each workstation, should be associated with domain names. Otherwise we will have problems with NFS, which is used for supporting access from the workstation to the central network server.

It's time to configure xfs (X-Windows font server). One could argue that each station could have its own package with fonts, but from my point of view, the proper solution will be a centralized font server.

To accomplish this, comment out the line no-listen = tcp in the file /etc/X11/fs/config and reload the xfs service"

service xfs start

Make sure you perform an actual restart, not a reload, or xfs will not handle network requests properly.

Also, we need to finish configuring NFS. In file /etc/exports fix these lines:

/opt/ltsp/i386                  192.168.0.0/255.255.255.0(ro,no_root_squash)
/var/opt/ltsp/swapfiles         192.168.0.0/255.255.255.0(rw,no_root_squash)

by correctly setting your own network addresses.

In the next step, you will configure /opt/ltsp/i386/etc/lts.conf. In this file all of the settings for the workstations are stored. In the first block of arguments are the default settings.

    [Default]
    SERVER             = 192.168.0.254
    XSERVER            = auto
    X_MOUSE_PROTOCOL   = "PS/2"
    X_MOUSE_DEVICE     = "/dev/psaux"
    X_MOUSE_RESOLUTION = 400
    X_MOUSE_BUTTONS    = 3
    USE_XFS            = Y
    LOCAL_APPS         = N
    RUNLEVEL           = 5

All of these arguments are understandable by their names, but here's a brief explanation:

  • SERVER - host address with which all diskless workstations will be working. Also this address will be default for the font server and log server, if these names are not set.
  • XSERVER - X-server (as application) that will be executed on workstations. By default this is autodetected. For xFree 4x, we can set the name of the loadable module. For XFree 3.3.6, this value is the name of the X server (for example, XF86_SVGA)
  • X_MOUSE_PROTOCOL - type of mouse.
    • Microsoft - for mouse, which is connected via COM-port
    • PS/2 - for mouse which is connected via PS/2 port.
  • X_MOUSE_DEVICE - device to which mouse is connected. For example, for COM1 it is /dev/ttyS0, for COM2 - /dev/ttyS1, for PS/2 - /dev/psaux
  • X_MOUSE_BUTTONS - number of mouse buttons (2 or 3).
  • USE_XFS - to use or not to use font server. We have to set Y - to use font server.
  • LOCAL_APPS - will be Y only when we need to execute applications on a local workstation. It also requires the package ltsp_local_apps be installed.
  • RUNLEVEL - 5 for graphic console.

The next blocks consist of individual descriptions and detailed settings for specific workstations and are named after the workstations. Everything inside these blocks will override all default values.

    [ws001]
    XSERVER            = auto
    LOCAL_APPS         = N
    USE_NFS_SWAP       = N
    SWAPFILE_SIZE      = 48m
    RUNLEVEL           = 5

Notice there are two new lines here, as compared to the default settings.

  • USE_NFS_SWAP - to use or not swap file on network partition. If we have at least 64Mb RAM on our workstation we can set it to N (do not use).
  • SWAPFILE_SIZE - swap file size, in case if we will use it.

In the case of a workstation, on which we do not have anything except the kernel and X-server and nothing more will be executed--we will not need a lot of memory. That's why you will only need swap only if the workstation's RAM is very small or some applications are executed locally. I suggest not using swap; it works too slowly, and it overloads network a lot.

We also have a few very useful arguments, X_MODE_0, X_MODE_1, X_MODE_2, and so on, which help set screen resolutions:

    X_MODE_0 = 800x600
    X_MODE_1 = 1024x768

This will set the screen resolution to 800x600 during boot process, and will set the resolution to 1024x768 by pressing Ctrl-Alt-Plus.

A full list of arguments you can use in lts.conf are described in the file lts.conf.readme, which I recommend you peruse.

If you are using X Window on the server we need to modify the file /etc/X11/xdm/Xservers and uncomment the line

    :0 local /usr/X11R6/bin/X

And, to crown it all, do not forget to set the X server to runlevel 5. This way NFS and xdm (gdm, kdm) will both be started.

Prepping the Workstations

First of all, visit Rom-o-matic and create a boot program for your network cards. On this site, you can get this program in two variants: for hard-coding into the network card for diskette booting. The second variant can be used for debugging or checking procedures.

Write the image (about 32kb) onto a diskette (don't forget to insert it!) and type:

dd if=eb-5.0.7-netcard.lzdsk of=/dev/fd0

where eb-5.0.7-netcard.lzdsk is the file downloaded from the Rom-o-matic site.

Now the bootable diskette is ready. Boot from it on the workstation and after the boot process is finished X Window will appear ready to login.

Configuring Sound on LTSP

To support multimedia applications on the workstation, yopu will have to configure sound support. This brings up a rather thorny problem because in reality all the applications are executed not on the local station, but rather on the main server. This means that we need to transfer all sound streams from the server to workstation via the network.

Initially, this seems to be a difficult task, but such software already exists to handle it--a special package called ltsp_sound can do all of these things, which can easily be downloaded from the LTSP developers site.

This package isn't available as an RPM, so after downloading, we need to unpack the archive file into a temporary directory and execute script included in the package as superuser (root). Remember, make sure, the PATH statement contains /sbin and /usr/sbin:

export PATH=$PATH:/sbin:/usr/sbin
./install.sh
LTSP Sound v3.0.1 by Andrew Williams (mistik1@geeksinthehood.net)
Originally created by Boris Reisig (boris@microtrader.com)
Bash Version=2.05a.0(1)-release
Installing Base package.
Please make sure to unset LD_PRELOAD before you use this
if have a previous ltsp Sound package installed
About to install the libs, Are you sure you want to continue? [Y/N]:
    
Confirm (Y):
    
Putting files in /opt/ltsp
   
Setting up Environment variables adding ltsp-sound.sh
    
Would you like to install the nasd sound utilities package? [Y/N]:

Confirm (Y). Nasd - it's special sound server:

Putting files in /opt/ltsp

Setting up Environment variables adding ltsp-sound.sh

Would you like to install the nasd sound utilities package? [Y/N]:y
Putting files in /opt/ltsp

Setting up Environment variables adding ltsp-sound.sh

Would you like to install the nasd sound utilities package? [Y/N]:y
Installation *Complete*

!!NOTE: Please read "/opt/ltsp/i386/etc/lts.conf.sound" for more info
You *SHOULD* turn down your workstation speakers as this
package is installed default to ramp the sound volume
on loading of the sound daemon
			
Have Fun!!!

We now just have to modify the configuration of the network's workstations. In the lts.conf file, in the settings section, we will add these lines:

    SOUND              = Y
    SOUND_DAEMON       = nasd   # This can be 'nasd', or 'esd' at this time
    VOLUME             = 100    # Speaker & WAVE volume pecentage
    MIC_VOLUME         = 100    # Microphone volume
    CD_VOLUME          = 75     # CD Audio volume
    SMODULE_01         = auto   # sound chip auto detect 

    Nasd - it's special daemon, which receives/send media data over network.
    VOLUME - software settings for volume range.
    MIC_VOLUME - software settings for microphone sensivity.
    CD_VOLUME - software settings for CD audion input sensivity.
    SMODULE_01 - name of loadable module of soundcard or auto for autodetect.

If your soundcard cannot be autodetected, you can configure it manually:

    SMODULE_01         = soundcore
    SMODULE_02         = uart401
    SMODULE_03         = sb io=0x220 irq=5 dma=1

In this example, by the way, we are configuring a Sound Blaster-compatible card.

After the workstation reloads, we can use xmms and many other multimedia applications.

A Few Notes About Security

System administrators, when finished configuring the diskless workstations, need to take care about security. Services used in such networks (NFS, X Window) are rather weak, and they have rather insecure tools for restricted access.

This is why a aystem administrator needs:

  • to make DHCP allocates IP addresses with attachments to real MAC addresses of network cards.
  • to configure the firewall to allow access to ports 514/udp (syslog), 7100/tcp (font server), 2049/tcp/udp (nfs) for local workstations only.
  • to restrict access to xdm.

This last requirement is handled in the /etc/X11/xdm/Xaccess file, where you can define a list of local diskless workstations and allow access only for them by commenting out the lines:

    *                                       #any host can get a login window
    *               CHOOSER BROADCAST       #any indirect host can get a chooser

and creating a list of actual workstations:

    ws001
    ws002
    %hostlist ws001 ws002
    *               CHOOSER %hostlist

Wrapping Up

In this article we have not discussed a big picture of LTSP software abilities, such as local application execution, text mode, print to local printer, working with local devices (floppy, disks), NIS, and many others. This is more in the scope of the excellent LTSP documentation that's out there today.

But even from this short article you will understand that diskless workstations (X-terminals) allow us to economize on hardware, they are generally safer, and are easier to manage from a system administrator's point of view.

Once IT managers will pay for some of the time to create network with diskless workstations, they will ultimately save a good chunk of change for their companies.

Copyright Jupitermedia Corp. All Rights Reserved.