Install LTSP (Linux Terminal Server Project) on Ubuntu 14.04 LTS Server

Premise

This guide asumes that you want to install a LTSP server on top of a Ubuntu 14.04 LTS headles server with one NIC, in a local network connected to a router capable of DHCP as well as network address reservation.  Details about LTSP can be found on the http://www.ltsp.org page.

Host server installation

  • Start with the installation of the ubuntu server. Pick the release 14.04.05 LTS from this site http://releases.ubuntu.com/ and install the server. When prompted for package options at server installation you may opt for the OpenSSH server package.
  • update the server and the packages after installation. In a terminal do:

sudo apt-get update

sudo apt-get upgrade

Fix the IP address of the server. To do this,

    • On the router, go to the DHCP settings and reserve a fixed address to the server identified by the MAC of the NIC, say 192.168.0.56. In the same time set up the boundaries for address reservation for the Thin clients. This depends on how many Thin clients would you allow to connect to the terminal server. 

or,

    • Another alternative is to assign a static IP address to the server, on server side. In order to do this, you must limit first the DHCP dynamic range of the router and assign to the server an IP address outside this range. Same for the boundaries set up for the Thin clients. To setup the static IP adress, in a terminal do:

sudo vi /network/interfaces

By default, the file looks like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

Change the last line as follows, putting the right addresses according to your local network setting consistent with the router setup:

iface eth0 inet static
        address 192.168.0.56
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1
        dns-search home

 

[Esc], then Save and quit:

:wq

Install the LTSP server and configure DHCP for the Thin clients

In the terminal, type:

sudo apt-get install ltsp-server-standalone

After the server is installed, configure the dhcp for the Thin clients:

sudo vi /etc/ltsp/dhcpd.conf

By default the file should look like this:

# Default LTSP dhcpd.conf config file.
#

authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.20 192.168.0.250;
        option domain-name "example.com";
        option domain-name-servers 192.168.0.1;
        option broadcast-address 192.168.0.255;
        option routers 192.168.0.1;
#      next-server 192.168.0.1;
#      get-lease-hostnames true;
        option subnet-mask 255.255.255.0;
        option root-path "/opt/ltsp/i386";
        if substring( option vendor-class-identifier, 0, 9 ) = "PXEClient" {
                filename "/ltsp/i386/pxelinux.0";
        } else {
                filename "/ltsp/i386/nbi.img";
        }
}

Change the first three sets of numbers of the subnet to match your IP address. The IP address of the machine I'm using currently is 192.168.0.56. For the range you need to make sure you set these to be outside the DHCP range dished out by your router. My router issues IP addresses from 192.168.0.2 to 192.168.0.64, I adapted the range from 192.168.0.70 to 192.168.0.80.

Here's mine.

# Default LTSP dhcpd.conf config file.
#

authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.70 192.168.0.80;
        option domain-name "example.com";
        option domain-name-servers 192.168.0.1;
        option broadcast-address 192.168.0.255;
        option routers 192.168.0.1;
#      next-server 192.168.0.1;
#      get-lease-hostnames true;
        option subnet-mask 255.255.255.0;
        option root-path "/opt/ltsp/i386";
        if substring( option vendor-class-identifier, 0, 9 ) = "PXEClient" {
                filename "/ltsp/i386/pxelinux.0";
        } else {
                filename "/ltsp/i386/nbi.img";
        }
}

When you're done editing the file press the [Esc] key once and type the following:

:wq

This should save the changes and bring you back to the command line. We should now restart the DHCP server by issuing the following command:

sudo service isc-dhcp-server restart

Build the LTSP environment and the client image

Now we're done configuring the basics. The next step is to build the LTSP Thin client image by issuing the following command. This will take some time so be patient. It is recommended to build a 32bit image, if we don't know all client PC will support 64bit images. If you want to build a 64bit image, skip the "--arch i386" argument.

sudo ltsp-build-client --arch i386

This will run for some time, ending up with a message like LTSP client installation completed successfully. Now it's time to reboot the host server:

sudo reboot

Boot up a Thin Client

Once the host server has rebooted, we should now be able to boot our Thin client. Connect the client PC to the local network (router), power-up the machine and go to the BIOS settings. Set as primary boot device the PXE, save and exit BIOS. Once the machine re-run the BIOS POST (PowerOnSelfTest), it should check for the network boot and boot the Thin client, showing the Ubuntu Thin Client logon screen:

Image result for thin client logon screen ubuntu

 

At this stage, the client doesn't have yet a desktop environment, so for now click on Preferences on the Thin Client login screen and shut down the thin client.

Configure the LTSP environment

Now we need to configure our Thin client with a desktop environment and add some nice applications. But first, we need to prepare the upgrade environment. To do so, copy the source list from the host machine (our server) to the LTSP environment:

sudo cp /etc/apt/sources.list /opt/ltsp/i386/etc/apt/sources.list

In order to prevent the host server from restarting daemons during the upgrade of the chroot environment,

export LTSP_HANDLE_DAEMONS=false

Now let's switch to the chroot environment, mount /proc and do an update/dist-upgrade to pull down all updated packages:

sudo chroot /opt/ltsp/i386
mount -t proc proc /proc
apt-get update
apt-get upgrade

Now let's install an Ubuntu Desktop GUI for our LTSP clients:

apt-get install ubuntu-desktop

This will install the latest Unity environment for Ubuntu 14.04, with LibreOffice, Firefox and basic tools.

Add an Administrator user account to the chroot environment

While still in the chroot environment, add an administrator account for the Thin client and set the administrator password:

useradd -m [adminUserName] -G sudo
passwd[adminUserName]

Add the new username [adminUserName] to sudoers:

visudo
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
[adminUserName]   ALL=(ALL:ALL) ALL

:wq

Install other software packages you may need

You may want to add VLC video player, as the default one misses codecs as well as an antivirus, ClamAV:

apt-get install vlc
apt-get install clamav clamav-daemon
freshclam
/etc/init.d/clamav-daemon start

The same way, install all the packages you want, such as GIMP, and others. Once you are done, you may quit the chroot environment.

exit
sudo umount /opt/ltsp/i386/proc

Add regular users for the Thin client

Add all regular users you need for the Thin client on the host machine with as many commands below:

sudo adduser [newUser]

Rebuild the Thin client

Whenever you make any changes to your LTSP environment you need to run the following commands:

sudo ltsp-update-sshkeys

sudo ltsp-update-kernels

sudo ltsp-update-image /opt/ltsp/i386

The first one must be run whenever you change any IP settings. The second one updates the kernel if required and the last one rebuilds the LTSP client image to take account of any packages you've updated.

You should now be able to launch a thin client and once logged on be presented with a full-blown Ubuntu desktop environment.