Ltsp Clustering.

by Computothought in Circuits > Linux

6322 Views, 12 Favorites, 0 Comments

Ltsp Clustering.

ltsp-screenshot.png

This page is specific to Ubuntu versions 9.10, 10.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


 

 

LTSP-Cluster

When there is a need for hundreds or thousands thin clients, you need a ltsp-cluster. Read more about ltsp-cluster:

https://www.ltsp-cluster.org

In this guide we install very basic, but working ltsp-cluster for testing and studying purpose. We use here "A setup with internet connection" from wiring howto:

https://help.ubuntu.com/community/UbuntuLTSP/LTSPWiring

We need two x86_64/amd64 servers. First one is root server for all thin clients. Second one is application server for all thin clients in this guide. In the real world you need more than one application server, of course. And one server for home files (NFS) and one server for managing all the users (openLDAP). But as we said – this is very basic ltsp-cluster, just something to get familiar and start with.

Here is Stéphane Graber's excellent guide:

https://www.ltsp-cluster.org/documentation/howto/openvz-setup

We have named two server this way.

Ltsp-root01 – 192.168.1.101 | Ltsp-appserv01 – 192.168.1.102

Both servers need to know each others.

 

cat /etc/hosts

127.0.0.1       localhost
192.168.1.101   ltsp-root01
192.168.1.102   ltsp-appserv01
[--]

For the installation we need two CD's.

For the root server we need "64-bit PC (AMD64) server install CD". http://releases.ubuntu.com/9.10/

For the application server we need “64-bit PC (AMD64) alternate install CD". http://releases.ubuntu.com/9.10/

 

Note: somehow the last section disappeared. It has been restored.

Root Server for LTSP-Cluster

ltsp-screenshot.png
Some of this may be old hat by now.

Root Server for LTSP-Cluster

We use "64-bit PC (AMD64) server install CD" to install root server. Do not install anything extra – just SSH server. After that make all updates and upgrades.

 

sudo apt-get update
sudo apt-get dist-upgrade

 

uname -a
Linux ltsp-root01 2.6.31-12-server #40-Ubuntu SMP Wed Oct 7 05:13:39 UTC 2009 x86_64 GNU/Linux

 

Install ltsp- and dhcp3-servers

Install ltsp- and dhcp3-servers in root server.

 

sudo apt-get install ltsp-server dhcp3-server

Modify dhcp3.conf for your network. Here we use this one. Note: File is not in /etc/ltsp directory!

 

sudo nano /etc/dhcp3/dhcpd.conf

 

# /etc/dhcp3/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
  option domain-name "ubuntu-ltsp5";
  option domain-name-servers 192.168.1.1;
  option routers 192.168.1.1;
  range 192.168.1.200 192.168.1.250;
  next-server 192.168.1.101;
  filename "/ltsp/i386/pxelinux.0";
}

Restart dhcp3-server.

 

sudo /etc/init.d/dhcp3-server restart

 

Build chroot

Thin clients need 32-bit chroot. Build that one this way in root server.

 

sudo ltsp-build-client --arch i386 --ltsp-cluster --prompt-rootpass

When asked for ltsp-cluster settings answer as follow. Remember change “Server name” if needed.

 

Configuration of LTSP-Cluster
NOTE: booleans must be answered as uppercase Y or N
Server name: 192.168.1.101
Port (default: 80): 80
Use SSL [y/N]: N
Enable hardware inventory [Y/n]: Y
Request timeout (default: 2): 2

Root user passwd for chroot will be asked, too.

 

Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Your answered setup is in this file: /opt/ltsp/i386/etc/ltsp/getltscfg-cluster.conf

 

SERVER=192.168.1.101
PORT=80
ENABLE_SSL=N
INVENTORY=Y
TIMEOUT=2

 


Install Ltsp-cluster-control

ltsp-screenshot.png

Install ltsp-cluster-control

Install web based admin program for thin clients in root server.

 

sudo apt-get install ltsp-cluster-control postgresql

Modify program's configuration file. Note: Do not left any empty lines before or after php-tags (<?php / ?>) - php will not run!

 

sudo nano /etc/ltsp/ltsp-cluster-control.config.php

In this setup we use this one. Note all database related information.

 

<?php
    $CONFIG['save'] = "Save";
    $CONFIG['lang'] = "en"; #Language for the interface (en and fr are supported"
    $CONFIG['charset'] = "UTF-8";
    $CONFIG['use_https'] = "false"; #Force https
    $CONFIG['terminal_auth'] = "false";
    $CONFIG['db_server'] = "localhost"; #Hostname of the database server
    $CONFIG['db_user'] = "ltsp"; #Username to access the database
    $CONFIG['db_password'] = "ltsp"; #Password to access the database
    $CONFIG['db_name'] = "ltsp"; #Database name
    $CONFIG['db_type'] = "postgres"; #Database type (only postgres is supported)
    $CONFIG['auth_name'] = "EmptyAuth";
    $CONFIG['loadbalancer'] = "192.168.1.101"; #Hostname of the loadbalancer
    $CONFIG['first_setup_lock'] = "TRUE";
    $CONFIG['printer_servers'] = array("cups.yourdomain.com"); #Hostname(s) of your print servers
    $CONFIG['rootInstall'] = "/usr/share/ltsp-cluster-control/Admin/";
?>

Create new user for database. Use same passwd as above (db_password = ltsp)

 

sudo -u postgres createuser -SDRIP ltsp
Enter password for new role: 
Enter it again: 

Create new database.

 

sudo -u postgres createdb ltsp -O ltsp

Move to the new directory and create tables in database.

 

cd /usr/share/ltsp-cluster-control/DB/

 

cat schema.sql functions.sql | psql -h localhost ltsp ltsp

Password for user ltsp: 

Now you have to act as a root user and move to the /root directory.

 

sudo su
cd /root

Get two files for database.

 

wget http://bazaar.launchpad.net/%7Eltsp-cluster-team/ltsp-cluster/ltsp-cluster-control\/download/head%3A/controlcenter.py-20090118065910-j5inpmeqapsuuepd-3/control-center.py

 

wget http://bazaar.launchpad.net/%7Eltsp-cluster-team/ltsp-cluster/ltsp-cluster-control\/download/head%3A/rdpldm.config-20090430131602-g0xccqrcx91oxsl0-1/rdp%2Bldm.config

Modify control-center.py file, use same information for database as above.

 

nano control-center.py

 

#/usr/bin/python
import pgdb, os, sys

#FIXME: This should be a configuration file
db_user="ltsp"
db_password="ltsp"
db_host="localhost"
db_database="ltsp"

Install one python-package.

 

apt-get install python-pygresql

Stop Apche2 and install two files.

 

/etc/init.d/apache2 stop

 

python control-center.py rdp+ldm.config

Cleaned status table
Cleaned log table
Cleaned computershw table
Cleaned status table
Cleaned log table
Cleaned computershw table
Regenerated tree

Start Apache2 again.

 

/etc/init.d/apache2 start

Stop acting like a root user.

 

exit

Open your Firefox and go to the admin web page.

 

http://ltsp-root01/ltsp-cluster-control/Admin/admin.php

In the first page (“Configuration”) make few changes, this way.

 

LANG = en_EN.UTF-8
LDM_DIRECTX = True
LDM_SERVER = %LOADBALANCER%
LOCAL_APPS_MENU = True
SCREEN_07 = ldm
TIMESERVER = ntp.ubuntu.com
XKBLAYOUT = en

Create a new node.

  • Press the Create child buton
  • Type the name of your node in the Name field and press save

Here are some screenshots after all setups.

http://www.arkki.info/howto/Wiki/LTSP-Cluster/LTSP-ClusterControlCenter-01.png

http://www.arkki.info/howto/Wiki/LTSP-Cluster/LTSP-ClusterControlCenter-02.png

http://www.arkki.info/howto/Wiki/LTSP-Cluster/LTSP-ClusterControlCenter-03.png

http://www.arkki.info/howto/Wiki/LTSP-Cluster/LTSP-ClusterControlCenter-04.png

 

Install loadbalancer

Install loadbalancer in root server.

 

sudo apt-get install ltsp-cluster-lbserver

Modify information for loadbalancer.

 

sudo nano /etc/ltsp/lbsconfig.xml

Here we have only one application server: <node address="http://192.168.1.102:8000" name="ltsp-appserv01"/>

We have changed group name to “karmic” and max-threads to “1”.

 

cat /etc/ltsp/lbsconfig.xml

<?xml version="1.0"?>
<lbsconfig>
    <lbservice listen="*:8008" max-threads="1" refresh-delay="60" returns="$IP"/>
    <lbslave is-slave="false"/>
    <mgmtservice enabled="true" listen="*:8001"/>
    <nodes>
        <group default="true" name="karmic">
            <node address="http://192.168.1.102:8000" name="ltsp-appserv01"/>
        </group>
    </nodes>
    <rules>
        <variable name="LOADAVG" weight="50">
            <rule capacity=".7"/>
        </variable>
        <variable name="NBX11SESS" weight="25">
            <rule capacity="$CPUFREQ*$CPUCOUNT*$CPUCOUNT/120" critical="$CPUFREQ*$CPUCOUNT*$CPUCOUNT/100"/>
        </variable>
        <variable name="MEMUSED" weight="25">
            <rule capacity="$MEMTOTAL-100000"/>
        </variable>
    </rules>
</lbsconfig>

We have now root server ready.

Application Server

ltsp-screenshot.png

Application Server for LTSP-Cluster

We use "64-bit PC (AMD64) alternate install CD" to install application server. Do not install anything extra – nothing at all LTSP related. After that make all updates and upgrades.

 

sudo apt-get update
sudo apt-get dist-upgrade

 

uname -a
Linux ltsp-appserv01 2.6.31-12-generic #40-Ubuntu SMP Wed Oct 7 04:13:44 UTC 2009 x86_64 GNU/Linux

We install following packages.

 

sudo apt-get install ubuntu-desktop ltsp-server ltsp-cluster-lbagent ltsp-cluster-accountmanager

Remove few useless packages.

 

sudo apt-get remove --purge gnome-screensaver compiz

Be sure that everything is in good shape.

 

sudo apt-get autoremove && sudo apt-get autoclean

Remove following services.

 

sudo update-rc.d -f nbd-server remove

sudo update-rc.d -f gdm remove

sudo update-rc.d -f bluetooth remove

sudo update-rc.d -f pulseaudio remove

Create following file and copy this inside that file.

 

sudo nano /etc/xdg/autostart/pulseaudio-module-suspend-on-idle.desktop

 

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=PulseAudio Session Management
Comment=Load module-suspend-on-idle into PulseAudio
Exec=pactl load-module module-suspend-on-idle
Terminal=false
Type=Application
Categories=
GenericName=

Create a test user and add user to the following groups.

 

sudo adduser ltsp001

sudo adduser ltsp001 fuse

sudo adduser ltsp001 audio

sudo adduser ltsp001 video

If ltsp-cluster-accountmanager is killing user sessions when using ldap authentication add the following to the /etc/pam.d/common-session file

session    optional     pam_ecryptfs.so unrwap
session    optional     pam_ck_connector.so nox11

We have updated and upgraded chroot and installed ssh, nano, mc and htop in chroot for testing purpose.

Here is user “ltsp001” at application server “ltsp-appserv01”

 

ltsp001@ltsp-appserv01:~$ uname -a
Linux ltsp-appserv01 2.6.31-12-generic #41-Ubuntu SMP Wed Oct 7 19:37:12 UTC 2009 x86_64 GNU/Linux
ltsp001@ltsp-appserv01:~$

Here is user “root” at thin client “ltsp200”

 

root@ltsp200:~# uname -a
Linux ltsp200 2.6.31-12-generic #41-Ubuntu SMP Wed Oct 7 18:42:46 UTC 2009 i686 GNU/Linux
root@ltsp200:~# ps ax | grep ltsp
 2291 ?        S      0:00 /bin/sh /usr/share/ltsp/screen_session 07
 4108 ?        S      0:00 /bin/openvt -f -w -c 7 -- /usr/share/ltsp/screen.d/ldm
 4109 tty7     Ss+    0:00 /bin/sh /usr/share/ltsp/screen.d/ldm
 4222 tty7     S+     0:00 xinit /usr/share/ltsp/xinitrc /usr/sbin/ldm -- :7 vt7 -auth /var/run/ldm-xauth-iVl786vMH/Xauthority -br
 4486 pts/0    Ss+    0:00 ssh -Y -t -M -S /var/run/ldm_socket_4241_192.168.1.102 -o NumberOfPasswordPrompts=1 ltsp001@192.168.1.102 echo LTSPROCKS; /bin/sh -
 5407 ?        Ssl    0:00 sshfs -o allow_other,ControlPath=/var/run/ldm_socket_4241_192.168.1.102 192.168.1.102:/home/ltsp001 /home/ltsp001
 5495 tty7     S      0:00 /bin/sh /usr/bin/ltsp-localappsd
 5499 tty7     S      0:00 ssh -Y -t -S /var/run/ldm_socket_4241_192.168.1.102 -l ltsp001 192.168.1.102  XDG_DATA_DIRS=/tmp/ltsp-localapps-ltsp001-MITLUY/:/usr/local/share/:/usr/share/ LTSP_CLIENT=192.168.1.200 LTSP_CLIENT_HOSTNAME=ltsp200  DISPLAY=192.168.1.200:7  PULSE_SERVER=tcp:192.168.1.200:4713 ESPEAKER=192.168.1.200:16001 /etc/X11/Xsession default < /dev/null > /dev/null ; /usr/sbin/ltspfsmounter all cleanup
 5651 pts/1    S+     0:00 grep ltsp
root@ltsp200:~#