Neste post iremos falar sobre uma solução muito interessante que pode ajudar muita gente tanto no trabalho quanto em casa. O LTSP (Linux Terminal Server Project).
O LTSP é um projeto desenvolvido para o Linux que possibilita o uso de um computador por vários terminais de acesso. É configurado um servidor principal (geralmente um computador de melhor performance, no qual está instalado o LTSP) e vários clientes conectados via rede a este servidor. Estes clientes somente são a saída do processamento do servidor, por isso, não necessitam do uso de discos rígidos. Uma imagem do sistema operacional é carregado via rede de forma rápida e fácil.
Esta idéia tem sido muito implementada em cursos de informática em locais carentes como favelas e etc justamente pelo baixo custo e fácil instalação do projeto.
Vamos à instalação:
# apt-get install ltsp-server-standalone openssh-serve
Para que os usuários possam se logar normalmente sem problema precisamos alterar o arquivo /etc/ssh/sshd_config:
*O caminho dos arquivos informados nestes post podem mudar de acordo com a distro usada!
<!–nextpage–>
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don’t read the user’s ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don’t trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
Devemos agora instalar e configurar um servidor DHCP que ficará fixo:
# apt-get install dhcp3-server
# vim /etc/dhcp3/dhcpd.conf
authoritative;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.20 192.168.0.250;
option domain-name “ltsp-server”;
option domain-name-servers 192.168.0.1;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
if substring( option vendor-class-identifier, 0, 9 ) = “PXEClient” {
filename “/ltsp/i386/pxelinux.0″;
}
else{
filename “/ltsp/i386/nbi.img”;
}
option root-path “/opt/ltsp/i386″;
}
Após estes passos, podemos startar o serviço dhcp.
# /etc/init.d/dhcp3-server start
Vamos agora criar os ambientes para os terminais:
#ltsp-build-client
Neste momento será criado o ambiente para todos os terminais. Deverá aguardar a mensagem de conclusão da criação.
info: instalação do cliente LTSP completada com sucesso
Caso dê algum erro remova o diretório /opt/ltsp e rode novamente o comando até que obtenha sucesso.
Vamos agora instalar o LTSPFS, sistema de arquivo remoto que vai nos permitir usar dispositivos removíveis nos terminais.
# apt-get install ltspfs
Vamos agora checar se foi instalado corretamente e se poderá ser usado:
dpkg -l ltspfs | grep ^ii
ii ltspfs 0.5.0~bzr20080109-3ubuntu3 Fuse based remote filesystem for LTSP thin clients
Instalando no ambiente chroot:
# chroot /opt/ltsp/i386 apt-get install ltspfsd
Verificando:
chroot /opt/ltsp/i386 dpkg -l ltspfsd | grep ^ii
ii ltspfsd 0.5.0~bzr20080109-3ubuntu3 Fuse based remote filesystem daemon for LTSP thin clients
Instalando servidor de som PulseAudio:
apt-get install pulseaudio pulseaudio-esound-compat pulseaudio-utils paprefs pavumeter \ pavucontrol padevchooser paman libao-pulse pulseaudio-module-hal \ pulseaudio-module-x11 pulseaudio-module-gconf pulseaudio-module-hal \ pulseaudio-module-lirc pulseaudio-module-zeroconf libpulse-mainloop-glib0 \ libpulse-browse0 audacious-plugins-extra libgstreamer-plugins-pulse0.10-0
no ambiente chroot:
#chroot /opt/ltsp/i386/ apt-get install pulseaudio pulseaudio-esound-compat pulseaudio-module-x11
Ajustando configurações do ALSA:
#vim /etc/asound.conf
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
Ajuste o som do GNOME para usar ALSA, vá em Sistema/Preferências/Som e mude tudo para ALSA.
Ajuste as preferências do sistema de som pulseaudio, vá em Aplicações/Som e Vídeo/Pulse Audio Preferentes:
X - Enable network access to local sound devices
X - Allow others machines in LAN to browse for local sound devices
X - Dont require authentication
Ajustando daemon do pulseadio:
#cp /opt/ltsp/i386/etc/pulse/daemon.conf /opt/ltsp/i386/etc/pulse/daemon.conf.old
#vim /opt/ltsp/i386/etc/pulse/daemon.conf
Remova todas as linhas e deixe apenas o conteúdo abaixo:
daemonize = 1 high-priority = 1 log-target = stderr resample-method = trivial no-cpu-limit = 1 system-instance = 1
Agora vamos editar as configurações padrão do pulseaudio, salvando primeiramente o arquivo de configuração padrão:
#cp /opt/ltsp/i386/etc/pulse/default.pa /opt/ltsp/i386/etc/pulse/default.pa.old #vim /opt/ltsp/i386/etc/pulse/default.pa Remova todas as linhas e deixe apenas o conteúdo abaixo:
### Load audio drivers automatically on access # mobo sound on hw:0 (default) add-autoload-sink default_output module-alsa-sink device=hw:0 sink_name=default_output add-autoload-source default_input module-alsa-source device=hw:0 source_name=default_input # USB phone on hw:1 add-autoload-sink phone_output module-alsa-sink device=hw:1 rate=8000 channels=1 sink_name=phone_output add-autoload-source phone_input module-alsa-source device=hw:1 rate=8000 channels=1 source_name=phone_input ### Network access load-module module-esound-protocol-tcp auth-anonymous=1 load-module module-native-protocol-tcp auth-anonymous=1 ### Automatically restore the volume of playback streams load-module module-volume-restore ### Automatically move streams to the default sink if the sink they are ### connected to dies, similar for sources load-module module-rescue-streams ### Make some devices default set-default-sink default_output set-default-source default_input .nofail Instalando o plugin para som em flash: #wget http://www.paulbetts.org/projects/libflashsupport_1.0~2219-1_i386.deb #dpkg -i libflashsupport_1.0~2219-1_i386.deb Ajustando o lts.conf: #vim /opt/ltsp/i386/etc/lts.conf
Apague o conteúdo do arquivo e insira o conteúdo abaixo:
# This is the default lts.conf file for ltsp 5.
# For more information about valid options please see:
# /usr/share/doc/ltsp-client/examples/lts-parameters.txt.gz
# in the client environment
[default]
SOUND=True
SOUND_DAEMON=pulse
LOCALDEV=True
NBD_SWAP=True
SYSLOG=server
XKBLAYOUT=br
XKBMODEL=abnt2
Basta agora reiniciar seu servidor e partir pro abraço! Em breve coloco mais funções.
Fontes : http://www.vivaolinux.com.br/artigo/LTSP-5-no-Ubuntu-8.04/
http://gutocarvalho.net/mediawiki/index.php/LTSP_Pantaneiro#ltspfs
