Thinstation

Thinstation ovvero come recuperare vecchi computer

References:

Cosa ci occorre

  • Procurarsi vecchi pc
  • Uno switch
  • Cavi di rete

Requisiti minimi

Per quanto riguarda il server:
almeno un pentium 4 2.8 G e 2g di ram

Per quanto riguarda i vecchi pc
pentium 133 con almeno 32 mb di ram

Preparazione del livecd

Dopo aver scaricato la livecd.basic.zip scompattiamola in una cartella chiamata thinstation,
ora ci troviamo davanti varie cartelle quelle che prenderemo in considerazione per questo
primo esempio sono :

  • CD
  • RebuildisoWithConf
  • floppy

Di default thinstation parte con floppy e cd ma per mia comodità ho voluto partire con solo il cd.
Per fare questo basta copiare tutto il contenuto de livecd.basic.iso che si trova nella cartella CD
nella cartella RebuildisoWithConf/cd-files ed aggiugere anche il contenuto della cartella floppy
Fatto questo avremmo una cartella cd-files contenente:

  • Una cartella denominata Thinstation.profile
  • initrd
  • isolinux.bin
  • isolinux.cfg
  • vmlinuz

spostiamoci nella cartella thinstation.profile ed editiamo il file thinstation.conf.user

il file si presenta così:

# --- Network configuration

# Give a different name to each PC
NET_HOSTNAME=MyThinclient

# If you want to use a DHCP server, comment out these params:
NET_USE_DHCP=On                                                    #<----- QUI
#NET_IP_ADDRESS=192.168.0.70
#NET_MASK=255.255.255.0
#NET_GATEWAY=192.168.0.1
#NET_DNS1=192.168.0.1
#NET_DNS2=192.168.0.21
#NET_DNS_SEARCH=cartoons.org.nz

# --- Session Options
#
# Note:                     # is a number equal to or greater than 0
#
# SESSION_#_TITLE           Title description for SESSION. Needed for replimenu.
# SESSION_#_TYPE            Package type, choose beetwen:
#                           - vncviewer        Start vncviewer in X
#                           - rdesktop         Start rdesktop in X
#                           - x                Start x-terminal session (xdm)
#                           - ssh              Start ssh client in linux console
#                           - telnet           Start telnet client in linux console
#                           - ica              Start Citrix ICA client in X
#                           - tn5250           Start AS400 client in linux console
# SESSION_#_SCREEN          Display number to run the X server on
# SESSION_#_AUTOSTART       ON      Application will be executed immediately at startup
#                           OFF     Application will appear in a menu to be started manually
# SESSION_#_WORKSPACE       Workspace to run program on in a window manager
# SESSION_#_type_SERVER     IP address/hostname of the server
# SESSION_#_type_OPTIONS    Command line options for the session type

# Individual Session Settings, override defaults
#
# IMPORTANT:  Make sure you minimum have a SESSION_0. Otherwise you will get an error  
# on boot. You may have additional sessions: SESSION_1, SESSION_2 ...
# SESSION_0 is on ctrl-alt-F3
# SESSION_1 is on ctrl-alt-F4
# ... etc.

# If you only have one session, it is a good idea to uncomment this line:
#AUTOSTART=On

# Typical Windows 2000 session  
#SESSION_0_TITLE="Windows 2000 terminal server"
#SESSION_0_TYPE=rdesktop
#SESSION_0_RDESKTOP_SERVER=192.168.1.1
#SESSION_0_RDESKTOP_OPTIONS="-u 'fred'"

# Typical Windows 2003 Server session, with True-color and sound redirection
# Note: use '-a 16' and '-a 24' to get true-color with Windows 2003+
# Older servers don't support these color depths, wrong settings may cause connection to fail.
#SESSION_1_TITLE="Windows 2003 terminal server (16 bit color depth)"
#SESSION_1_TYPE=rdesktop
#SESSION_1_RDESKTOP_SERVER=192.168.1.1
#SESSION_1_RDESKTOP_OPTIONS="-u user -p password -a 16 –r sound"
#Example on USB Printer Redirection for Rdesktop
#SESSION_#_RDESKTOP_OPTIONS="-r printer:usb='DYMO LabelWriter 400 Turbo'"

# Important: don't insert spaces in the session title
#SESSION_2_TITLE="CitrixServer"
#SESSION_2_TYPE=ica
#SESSION_2_ICA_APPLICATION_SET="Microsoft Word"
#SESSION_2_ICA_OPTIONS="-username donald -password qwak"

# ICA: Instead of connecting to an "application set",
# you can directly connect to a specific server desktop
# Important: don't insert spaces in the session title
#SESSION_3_TITLE="CitrixServer"
#SESSION_3_TYPE=ica
#SESSION_3_ICA_SERVER=ICA

SESSION_0_TITLE="Unix server"                                        #<----- QUI
SESSION_0_TYPE=x                                                    #<----- QUI
SESSION_0_X_SERVER=192.168.1.2                                    #<----- QUI
# Default is '-query'
##SESSION_0_X_OPTIONS="-N -K -a 16 -r sound:remote -r"
# You should set also "SCREEN_X_FONT_SERVER", below

#SESSION_#_TITLE="VNC server"
#SESSION_#_TYPE=vncviewer
#SESSION_#_VNCVIEWER_SERVER=192.168.1.2

#SESSION_#_TITLE="Telnet server"
#SESSION_#_TYPE=telnet
#SESSION_#_TELNET_SERVER=192.168.1.2

SESSION_1_TITLE="SSH server"                                        #<----- QUI
SESSION_1_TYPE=ssh                                                #<----- QUI
SESSION_1_SSH_SERVER=192.168.1.2                                #<----- QUI

#SESSION_#_TITLE="AS400 server"
#SESSION_#_TYPE=tn5250
#SESSION_#_TN5250_SERVER=192.168.1.2
# Use this option to specify keyboard map
#SESSION_#_TN5250_OPTIONS="map=280"
# Other options
#SESSION_#_TN5250_OPTIONS="env.DEVNAME=JDevBox1 +underscores env.TERM=IBM-3477-FC"

# --- General Options
#
# AUDIO_LEVEL        Audio Level for sound, 0-100
# KEYBOARD_MAP       Keyboard layout
# TIME_ZONE          Used to set time zone on TS client by entering the UTC offset.
#                    This can be set automatically if the appropriate dhcpc option is selected
#                    (Option 2, time offset in seconds)
# RECONNECT_PROMPT   This displays the reconnection/shutdown options for when a session is ended
#
#                    OFF    No reconnect prompt
#                    ON     Reconnect prompt will be displayed
#                    MENU   Shows a menu with a shutdown and reconnection option
#                    MENUXX As MENU option, but the XX is a time period in minutes.
#                           After XX minutes shutdown will occur unless the reconnect option
#                           is choosen

AUDIO_LEVEL=90                                                    #<----- QUI

# Look inside BuildFiles\build.conf* file for a list of the supported KB layouts
KEYBOARD_MAP=it                                                    #<----- QUI
#TIME_ZONE="UTC-12:30"
RECONNECT_PROMPT=On

# --- X Server Options
#
# SCREEN_RESOLUTION       Screen resolutions available in the workstations
# SCREEN_COLOR_DEPTH      Number of bits per pixel (8,16,24)
# SCREEN_HORIZSYNC        Monitor horizontal sync frequency in Khz.
#                         If left blank Xorg will try to detect with DDC
# SCREEN_VERTREFRESH      Monitor vertical refresh frecuency in Hz.
#                         If left blank Xorg will try to detect with DDC
# SCREEN_X_FONT_SERVER    IP address or hostname of the font server for X
#                        
#                         Screen Saver Settings
# SCREEN_BLANK_TIME       Minutes to X session goes blank
# SCREEN_STANDBY_TIME     Minutes to X session goes into standby mode
# SCREEN_SUSPEND_TIME     Minutes to X session goes into suspend mode
# SCREEN_OFF_TIME         Minutes to X session turn off
#
# MOUSE_PROTOCOL          Mouse protocol type (Microsoft, PS/2, etc.)
#                         (mouse is autodetected, use this only if it fails)
# MOUSE_DEVICE            Mouse device:  /dev/ttyS0 -> COM1
#                                   /dev/ttyS1 -> COM2
#                                   /dev/ttyS2 -> COM3
#                                   /dev/ttyS3 -> COM4
#                                   /dev/psaux -> PS/2 mouse port
#                                   /dev/input/mice -> USB mouse (needs USB package)
# MOUSE_RESOLUTION        Mouse resolution
# MOUSE_ACCELERATION      Mouse acceleration
# X_NUMLOCK               Set numlock state on boot
# X_COOKIE                Will set X Cookie if specified

#SCREEN_RESOLUTION="800x600"                                    #<----- QUI
SCREEN_RESOLUTION="1024x768"                                    #<----- QUI

SCREEN_COLOR_DEPTH="16"

SCREEN_HORIZSYNC="30-64"
SCREEN_VERTREFRESH="56-87

SCREEN_X_FONT_SERVER=192.168.1.2:7100                            #<----- QUI

SCREEN_BLANK_TIME=10
SCREEN_STANDBY_TIME=20
SCREEN_SUSPEND_TIME=30
SCREEN_OFF_TIME=60

#MOUSE_PROTOCOL=PS/2
#MOUSE_DEVICE=/dev/psaux
MOUSE_RESOLUTION=100
#X_NUMLOCK=Off
#MOUSE_ACCELERATION=1/2
#X_COOKIE=36d71ab65c10ef065702c111a3d31593

# --- Citrix ICA Specific Options
#
#                       GLOBAL Settings
#ICA_USE_SERVER_KEYBOARD    Use default server keyboard, otherwise use KEYBOARD_MAP
#                           variable
#ICA_BROWSER_PROTOCOL       Broswer protocol, can be HTTPonTCP or UDP
#
#                           APPLICATION SET settings
#ICA_ENCRYPTION             Encryption level for ICA
#                           Valid Settings Below
#                           "Basic"
#                           "RC5 (128 bit - Login Only)"
#                           "RC5 (40 bit)"
#                           "RC5 (128 bit)"
#                           "RC5 (56 bit)"
#ICA_COMPRESS               Compression, On/Off
#ICA_AUDIO                  Audio, On/Off
#ICA_AUDIO_QUALITY          Audio Quality, Low, Medium, High
#ICA_PRINTER                This will turn on ICA autocreate printers, see printer section
#                           for details, On/Off
#
#                           NOTE: You must have the lpr package included for this option
#                           to work.
#
#ICA_APPLICATION_SET        Published Application (Not needed if using
#                           ICA_SERVER)
#ICA_SERVER                 Server to Connect to (Not needed if using
#                           ICA_APPLICATION_SET, but needed if the ICA-Masterbrowser
#                           is not on the local network.)
#ICA_WFCLIENT_type_specific This allows you to specify specific config file details for global ica
#                           parameters any parameter can be changed with this setting. An example of this is
#                           ICA_WFCLIENT_CLIENTDRIVE="On"
#                           See your application manual for documentation on the settings which
#                           can be used.

#ICA_USE_SERVER_KEYBOARD=Off
#ICA_BROWSER_PROTOCOL=HTTPonTCP
#ICA_SERVER=
#ICA_ENCRYPTION=Basic
#ICA_COMPRESS=On
#ICA_AUDIO=On
#ICA_AUDIO_QUALITY=Low
#ICA_PRINTER=Off
#ICA_SEAMLESS_WINDOW=Off

# --- LP Server Printing Options
#
# PRINTER_0_NAME     Workstation Printer Name, Can be Any Valid Name
#                    If you have turned ICA_PRINTER=ON then this is the  
#                    name of the printer driver
# PRINTER_0_DEVICE   Workstation printer device (if not specified devices
#                    are not loaded).
#                       /dev/printers/[0-2]   for parallel ports
#                       /dev/ttyS[0-3] for serial ports
#                       /dev/usb/lp[0-2] for USB printers
#
# PRINTER_0_TYPE     P for parallel, S for serial, U for USB printer
# PRINTER_0_OPTIONS  Serial port options.
# PRINTER_1_*        See PRINTER_0_*
# PRINTER_2_*        See PRINTER_0_*
# PRINTER_3_*        See PRINTER_0_*

#PRINTER_0_NAME="parallel"
#PRINTER_0_DEVICE=/dev/printers/0
#PRINTER_0_TYPE=P

#PRINTER_1_NAME="serial"
#PRINTER_1_DEVICE=/dev/ttyS1
#PRINTER_1_TYPE=S
#PRINTER_1_OPTIONS="speed 38400 -imaxbel"

#PRINTER_2_NAME="usb"
#PRINTER_2_DEVICE=/dev/usb/lp0
#PRINTER_2_TYPE=U

#ICA Autocreate Printer Example

#PRINTER_0_NAME="HP LaserJet Series II"
#PRINTER_0_DEVICE=/dev/printers/0
#PRINTER_0_TYPE=P

Con questo file potete decidere diverse opzioni io per semplicità ho solo inserito x sesion e sh session
cambiato la tastiera e volume audio , di default è a 67 troppo basso,
ho usato dhcp, ma nulla vieta di impostare indirizzi statici e dnsserver,
ho impostato la risoluzione e le frequenze del monitor, che trattandosi di vecchi pc non fa mai male.
e session server a 192.168.1.2 (da ricordare per le impostazioni del server e del dhcp3-server) ma nulla ci vieta di impostare a query
Comunque le scelte sono varie. Quelle in grassetto sono le voci da me cambiate.
Fatto questo si ci sposta in thinstation/RebuildWithConf si rende eseguibile il file rebuid-iso.bat
e lo si lancia, alla fine del suo lavoro ci ritroveremo nella cartella il Thinstation.iso
Finito la nostra prima iso è stata costruita non ci resta che masterizzare metterla nel vecchio pc
e far partire da cd.

Configurare il server

Dopo la prima installazione di Debian Lenny per prima cosa dobbiamo abilitare il desktop remoto
per fare questo entriamo in Sistema====>preferenze===>Desktop remoto e mettiamo le prime due opzioni
andiamo in avanzate e spuntiamo consentire solo connessioni locali,
ora ci spostiamo in Sistema===>amministrazione===>finestra di accesso===>Remoto
e impostiamo Stile:come locale
da remoto ci spostiamo in Sicurezza e impostiamo vietare connessioni TCP al server X
impostiamo Permettere l'accesso solo se l'utente è proprietario della sua directory,
i permessi a scelta.
Fatto questo abbiamo abilitato il desktop remoto tramite prot XDMCP
Ci serve ancora installare dhcp3-server ed esound
da Synaptic installiamo dhcp3-server ed editiamo il su file di conf.
che si trova in /etc/dhcp3/dhcpd.conf
e per ora impostiamo solo questo:

# This is a very basic subnet declaration.

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.50 192.168.1.100;
}

questo perchè abbiamo impostato thinstation per x server a 192.168.1.2
aggiungiamo qualche user (quanti sono i vostri pc) e
fatto ciò possiamo riavviare il server,
avviamo dhcp3-server con /etc/init.d/dhcp3-server start e il gioco è fatto

Colleghiamo il client (o i client ) e il server allo switch, tramite i cavi di rete,
avviamo il client da cd e alla schermata di replimenù

avremo le due scelte prima configurate in thinstation profile
clicchiamo sulla x session e si aprirà il login di gdm
a quel punto siamo già sul server

Diciamo che questa è la prima prova base per lavorare con thin client
giusto per vederne il funzionamento e le prestazioni.
In seguito vedremo la costruzione di thinstation completa di interfaccia grafica e tutte le sue
innumerevoli impostazioni

aprendo una sessione si nota subito la mancanza dell'audio,
questo perchè non abbiamo ancora installato un server audio,
nel nostro caso apriamo Synaptic e installiamo esound.
finito andiamo su sistema===>preferenze===>audio
e come riproduzione audio scegliamo esd-enlightened Sound Daemon
sia in eventi sonori , in musica e filmati e in videoconferenza
infine in tracce predefinite del mixer scegliamo Alsa mixer
Tutto fatto riavviamo ed abbiamo la prima sessione grafica remota con l'audio

IL complicato è stato dare a tutti gli utenti l'audio, complice esound.
Infatti il primo client si connetteva a esd e aveva l'audio ma quando
provavo a connettere un secondo client mi dava connection impossible
Dopo vari tentativi riavviavo aprivo una sessione con un client diverso dal primo
ed esound rifunzionava, ma come al solito non gli altri clients.
Ho cominciato a pensare che esound accettasse solo un client,
e scriveva il file .esd_auth nella home del client,
sono andato a guardare codesto file ed era
effettivamente diverso per ogni utente, IDEA
riavvio apro il primo client, ottimo funziona, killo ESD,
copio il file .esd_auth del client che funzionava in tutte le altre home utenti,
sovrascrivendo i vecchi, riavvio esd con esd &, apro il primo client ,funziona ed anche tutti tutti
gli altri, EUREKA

Questo è quanto riporta top con 2 client più il server tutti con Rhythmbox aperto su virgin radio rock,
la mia preferita, e con firefox apert su tutti

pino@debianpino:~$ top

top - 15:03:02 up 8 min,  3 users,  load average: 0.28, 0.27, 0.14
Tasks: 160 total,   4 running, 156 sleeping,   0 stopped,   0 zombie
Cpu(s):  7.0%us,  1.8%sy,  0.0%ni, 90.4%id,  0.2%wa,  0.5%hi,  0.2%si,  0.0%st
Mem:   2076104k total,   564184k used,  1511920k free,    18612k buffers
Swap:  1952816k total,        0k used,  1952816k free,   183288k cached

Ecco anche un pò di risultati tecnici

Variazione uso memoria durante il collegamento primo client

free -s 5 -c 5

             total       used       free     shared    buffers     cached
Mem:       2076104     658044    1418060          0      35076     277312
-/+ buffers/cache:     345656    1730448
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     672048    1404056          0      35084     277316
-/+ buffers/cache:     359648    1716456
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     673628    1402476          0      35096     277252
-/+ buffers/cache:     361280    1714824
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     663280    1412824          0      35112     277272
-/+ buffers/cache:     350896    1725208
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     701728    1374376          0      35120     277352
-/+ buffers/cache:     389256    1686848
Swap:      1952816          0    1952816

Variazione uso cpu durante collegameno del primo client

sar -u 10 5
Linux 2.6.26-1-686 (debianpino)     07/06/2009     _i686_

23:25:11        CPU     %user     %nice   %system   %iowait    %steal     %idle
23:25:21        all      8,41      0,00      1,14      0,10      0,00     90,36
23:25:31        all     17,35      0,00      4,08      0,20      0,00     78,37
23:25:41        all      0,84      0,00      0,30      1,23      0,00     97,63
23:25:51        all      0,60      0,00      0,20      0,10      0,00     99,11
23:26:01        all      0,59      0,00      0,35      1,44      0,00     97,62
Media:          all      5,55      0,00      1,21      0,61      0,00     92,63

Variazione uso memoria dopo collegamento secondo client

free -s 5 -c 5

             total       used       free     shared    buffers     cached
Mem:       2076104     718516    1357588          0      36188     278308
-/+ buffers/cache:     404020    1672084
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     747000    1329104          0      36200     278308
-/+ buffers/cache:     432492    1643612
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     735744    1340360          0      36208     278308
-/+ buffers/cache:     421228    1654876
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     723276    1352828          0      36212     278324
-/+ buffers/cache:     408740    1667364
Swap:      1952816          0    1952816

             total       used       free     shared    buffers     cached
Mem:       2076104     762400    1313704          0      36232     278420
-/+ buffers/cache:     447748    1628356
Swap:      1952816          0    1952816

Variazion uso cpu dopo il collegamento del secondo client

sar -u 10 5

Linux 2.6.26-1-686 (debianpino)     07/06/2009     _i686_

23:30:39        CPU     %user     %nice   %system   %iowait    %steal     %idle
23:30:49        all      8,93      0,00      1,38      0,05      0,00     89,63
23:30:59        all      9,55      0,00      3,77      1,22      0,00     85,46
23:31:09        all      3,59      0,00      0,39      0,05      0,00     95,97
23:31:19        all      0,34      0,00      0,29      1,52      0,00     97,84
23:31:29        all      0,45      0,00      0,20      0,00      0,00     99,36
Media:          all      4,58      0,00      1,21      0,57      0,00     93,64
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.