Outils pour utilisateurs

Outils du site


issue109:labolinux2

Table des matières

1

Last month, our refurbishing not-for-profit was approached by a small not-for-profit community looking for a donation of used computers. The organization had recently been given some space in which to meet (they’d been meeting in member’s houses before this), and now needed a few computers so members could learn basic computer skills. In my original discussion with the executive, they mentioned that the organization had no funding for computers. After a short discussion about licensing and what the organization was looking for, it dawned on me that a Linux Terminal Server Project (http://ltsp.org/) might work for them. I pulled out a thin client we’d just received as a donation and asked the executive if they were interested in a client/server setup. The executive seemed excited at the prospect of getting thin clients (having worked with them before), but their timeline was very short—less than 1 week. Having never even set up a PXE network boot server before, I needed clear instructions: I found them at Bobby Allen’s Blog: http://blog.bobbyallen.me/2015/07/19/setup-a-ubuntu-14-04-lts-mate-terminal-server-with-ltsp/

Le mois dernier, une communauté à but non lucratif qui cherchait des dons d'ordinateurs d'occasion a contacté notre projet non lucratif de réutilisation d'ordinateurs. On avait récemment fourni à l'organisation un endroit où se réunir (avant cela, les réunions se tenaient chez ses membres) et maintenant, elle avait besoin de quelques ordinateurs pour que ses membres puissent acquérir des compétences informatiques de base. Lorsque j'avais parlé pour la première fois avec le directoire, on m'avait indiqué que l'organisation n'avait pas d'argent pour des ordinateurs. Après une courte discussion sur les licences et ce que cherchait l'organisation, j'ai réalisé qu'un Linux Terminal Server Project (http://ltsp.org/) pourrait leur convenir. J'ai sorti un client léger que nous venions de recevoir comme don et j'ai demandé au directoire si une configuration client/serveur les intéresserait. [Ndt : voir https://fr.wikipedia.org/wiki/Client_l%C3%A9ger.] Ayant déjà travaillé avec des clients légers, le responsable semblait excité à l'idée d'en récupérer, mais il leur manquait du temps, moins d'une semaine.

N'ayant jamais configuré un serveur de démarrage PXE avant, j'avais besoin d'instructions explicites : je les ai trouvées sur le blog de Bobby Allen :

http://blog.bobbyallen.me/2015/07/19/setup-a-ubuntu-14-04-lts-mate-terminal-server-with-ltsp/

2

For the server, I used a retired desktop machine that our project once used as a SAMBA file server. The server had an Intel Core 2 Quad Q9400 (2666MHz processor) in it, and 2GB of DDR2 667MHz RAM. The drives we’d pulled and wiped a long time ago, so I installed a pair of matched 80GB hard drives. Initially I created a hardware-based RAID mirror (using the motherboard RAID controller), but I reconsidered the idea and decided just to ditch the hardware RAID and clone the installation drive once I was happy with the LTSP server setup. (In my experience people sometimes have “friends” with good intentions who install less than legitimate software on their computer, cloning the drive would at least give me some sort of backup should this happen). I also pulled the 2 x 1GB of RAM and inserted a matched pair of 2GB sticks for 4GB 800MHz DDR2 RAM. Initially I understood that the organization had an existing Internet connection so I figured the best thing to do was to set up the server for DHCP and when I got to the facility get their system administrator to set a DHCP reservation for the server, then update the SSH keys and the image that gets built.

Pour le serveur, j'ai choisi un ordinateur de bureau retraité que notre projet avait autrefois utilisé comme serveur de fichiers SAMBA. Le serveur contenait un Intel Core 2 Quad (un processeur à 2 666 MHz) et 2 Go de RAM DDR2 à 667 MHz. Il y a longtemps, nous avions enlevé et effacé les disques et j'y ai donc installé une paire de disques durs assortis de 80 Go. Au départ, j'ai créé un miroir RAID basé sur le matériel (en me servant du contrôleur RAID sur la carte mère), mais j'ai changé d'avis en décidant d'abandonner le RAID matériel et de cloner le disque d'installation une fois que la configuration du serveur LTSP me conviendrait. (D'après mon expérience, les gens ont parfois des « amis » bien intentionnés qui installent des logiciels illégitimes sur leur ordinateur et le clonage du disque me donnerait au moins une sorte de sauvegarde le cas échéant.) J'ai également enlevé la RAM de 2 x 1 Go et l'ai remplacée par une paire de barrettes de 2 Go pour avoir 4 Go de DDR2 RAM à 800 MHz.

Au départ, j'avais compris que l'organisation avait déjà une connexion à Internet et je pensais donc que la meilleure chose à faire était de paramétrer le serveur pour DHCP et, lorsque j'arriverai chez eux, de demander à leur administrateur système de configurer une réservation DHCP pour le serveur, puis de mettre à jour les clés SSH et l'image qui est alors construite.

3

There are a few ways to build LTSP images, but building an image off an existing installation seemed like the simplest way to go and Bobby’s instructions for updating an image are really clear. Some LTSP installations need 2 network interface cards, but Bobby’s method uses only one card and the LTSP server acts as a proxy for the clients. The server acting like a proxy tripped me up when I first got LTSP running because I couldn’t understand why the clients showed the server address when I ran the command: /sbin/ifconfig. After rebooting the client, I noticed a unique (non-server) IP address in the bottom right of the login screen. It’s only on logging in that the client uses the server’s IP as a proxy. Because all the clients would likely be 32-bit, and it wasn’t likely that the organization would have more than 3 or 4 computers, I chose to install the 32-bit version of Ubuntu MATE 14.04 on the server. As with any desktop or server installation, it’s always a good idea to update before installing any new software: sudo apt-get update

Il y a plusieurs façons de construire des images LTSP, mais il me semblait que la plus simple était d'utiliser une installation existante pour la construire et les instructions de Bobby pour la mise à jour d'une image sont vraiment très claires. Certaines installations LTSP ont besoin de deux cartes d'interface réseau, mais la méthode de Bobby n'en utilise qu'une et le serveur LTSP agit comme proxy pour les clients. Que le serveur agisse comme un proxy m'a rendu perplexe la première fois que j'exécutais LTSP, parce que je ne comprenais pas pourquoi les clients affichaient l'adresse du serveur quand j'ai lancé la commande : /sbin/ifconfig. Après avoir redémarré le client, j'ai remarqué une adresse IP unique (non-serveur) en bas à droite de l'écran d'accueil. Ce n'est qu'après sa connexion que le client utilise l'adresse IP du serveur comme proxy.

Puisque tous les clients seraient sans doute des 32-bit, et qu'il n'était pas vraisemblable que l'organisation ait plus de 3 ou 4 ordinateurs, j'ai choisi d'installer la version 32-bit d'Ubuntu MATE 14.04 sur le serveur.

Tout comme avec n'importe quel ordinateur de bureau ou serveur, c'est toujours une bonne idée de faire une mise à jour avant d'installer de nouveaux logiciels :

sudo apt-get update

4

Some LTSP server setups use the paradigm of letting the server act as a DHCP server for clients. Because I didn’t know the organization’s network setup, it seemed a better idea to allow their router to do DHCP, but the server would act as a proxy for the router - dnsmasq provides this functionality. Dnsmasq can be set up as a DHCP server, but, in this case, I used it to forward DNS to the clients. The LTSP image had to be deployed to the clients some way. Bobby mentions in his blog that dnsmasq can also act as a tftp server, but that the functionality is broken in Ubuntu 14.04. Ubuntu actually has a few tftp server packages in the repositories, but the one that he used, and that kept coming up on all the LTSP-related sites, was tftpd-hpa. Lastly, the ltsp-server package is needed so the LTSP client environment can be built. sudo apt-get install dnsmasq tftpd-hpa ltsp-server The next step is to build the LTSP image that will be served to the clients. Because the build process has to download packages, this step can take quite a bit of time, especially on a slow Internet connection, so be patient. In my case, I was building a 32-bit version of Ubuntu MATE because the thin clients I picked (I actually ended up using some old HP DC7100 Pentium 4 based desktops with no hard drives instead, but more on this later) were 32-bit, and because I’d installed a 32-bit version of Ubuntu MATE on the server. Build a 32-bit client using the following command: sudo ltsp-build-client –arch i386

Certaines configurations utilisent un modèle où le serveur LTSP agit comme serveur DHCP pour les clients. Puisque je ne connaissais pas la configuration du réseau de l'organisation, il me semblait plus judicieux de laisser leur routeur faire le DHCP, avec le serveur agissant comme proxy pour le routeur - dnsmasq fournit cette fonctionnalité. On peut configurer dnsmasq comme serveur DHCP, mais, dans ce cas précis, je l'ai utilisé pour transférer le DNS aux clients.

L'image de LTSP devait être déployée aux clients d'une façon ou d'une autre. Dans son blog, Bobby dit que dnsmasq peut aussi agir comme serveur tftp, mais cette fonctionnalité ne marche pas dans Ubuntu 14.04. En fait, il y a quelques paquets de serveur tftp dans les dépôts d'Ubuntu, mais celui qu'il a utilisé, et qui apparaissait sans cesse sur tous les sites concernant LTSP, était tftpd-hpa. Enfin, on a besoin du paquet ltsp-server pour pouvoir construire l'environnement client de LTSP.

sudo apt-get install dnsmasq tftpd-hpa ltsp-server

La prochaine étape est de construire l'image de LTSP qui sera servie aux clients. Étant donné que le processus doit télécharger des paquets, cette étape peut prendre pas mal de temps, surtout avec une connexion Internet lente ; soyez patient. Dans mon cas, je construisais une version 32-bit d'Ubuntu MATE parce que les clients légers que j'avais choisis (en fait, j'ai fini par utiliser à la place des ordinateurs de bureau HP DC7100 basés sur un Pentium 4, sans disque dur, mais je vous en donnerai des détails plus tard) étaient des 32-bit et parce que j'avais installé une version 32-bit d'Ubuntu MATE sur le serveur. Un client 32-bit se construit avec la commande suivante :

sudo ltsp-build-client –arch i386

5

If you’re building for 64-bit clients, just remove the –arch i386. You’ll also need to replace the i386 in several other places with amd64 including the next step, enabling the DHCP proxy support. For 32-bit images, run: sudo sed -i 's/ipappend 2/ipappend 3/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default Again, if you’re building for 64-bit, replace the tftpboot/ltsp/i386 with tftpboot/ltsp/amd64. Bobby also mentions that if you update your image, something I did several times, you’ll have to rerun the above command. (Once I tested my image on the clients, I decided to add several graphics and educational software packages to the server, rebuilding built them into the client image) DNSmasq needs to be set up so it can act as a proxy for the clients. At this point, I was stuck because I had no information about the organization’s existing Internet connection. On further discussion with the executive (and to my horror), I found out that the Internet connection they had was a wireless connection that someone was letting them use. Clearly, this wasn’t going to work, even with only 3 clients, they’d choke on a 54g wireless connection. We had a discussion about getting a wired connection, and I set up the rest of the LTSP configuration based on a wired router we had sitting around the shop. I also grabbed a 5-port gigabit switch. Although the router has 4 ports (in addition to the Internet port), all the ports were 10/100, so I connected the router and all the clients to the 5-port gigabit switch. I set the router to hand out DHCP in the 192.168.80.x address range. My /etc/dnsmasq.d/ltsp.conf file looked like that shown right.

Si vous construisez des clients 64-bit, il suffit d'enlever le –arch i386. Vous devez également remplacer le i386 par amd64 dans plusieurs autres endroits, y compris la prochaine étape, l'activation du support proxy DHCP. Pour des images 32-bit, lancez :

sudo sed -i 's/ipappend 2/ipappend 3/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default

Bien entendu, si vous construisez en 64-bit, remplacez la partie tftpboot/ltsp/i386 par tftpboot/ltsp/amd64. Bobby mentionne également que, si vous mettez votre image à jour (ce que j'ai fait plusieurs fois), il faut relancer cette même commande. (Après avoir testé l'image sur les clients, j'ai décidé d'ajouter plusieurs paquets de logiciels graphiques et pédagogiques au serveur et la reconstruction les a construits dans l'image client.)

Il faut paramétrer DNSmasq de sorte qu'il peut agir comme proxy pour les clients. À ce stade, j'étais coincé parce que je n'avais aucune information sur la connexion Internet existante de l'organisation. Ayant parlé à nouveau avec le responsable (et j'étais horrifié), j'ai appris que la connexion Internet qu'ils avaient était une connexion sans fil que quelqu'un leur laissait utiliser. Évidemment, cela ne fonctionnerait pas, même avec seulement 3 clients, qui étrangleraient une connexion sans fil 54g. Nous avons parlé de la possibilité d'avoir une connexion filaire et j'ai fait le reste de la configuration LTSP me basant sur un routeur filaire qui traînait dans l'atelier. J'ai aussi pris un commutateur Gigabit à 5 ports. Bien que le routeur possède 4 ports (outre le port Internet), tous étaient des 10/100 et j'ai donc connecté le routeur et tous les clients au commutateur Gigabit à 5 ports. J'ai réglé le routeur pour distribuer le DHCP dans la plage des adresses 192.168.80.x. Mon fichier /etc/dnsmasq.d/ltsp.conf ressemble à ce qui se voit à droite.

6

Again, if you’re building a 64-bit image, replace i386 with amd64 in the line: pxe-service=x86PC, “Boot from network”, /ltsp/amd64/pxelinux With dnsmasq set up, it was only a matter of restarting the dnsmasq service and booting the thin clients (or so I thought). Restart dnsmasq by running: sudo service dnsmasq restart I turned on the thin clients, they started to network boot and download the Ubuntu MATE image and I ended up staring at a black screen… After a bit of research, I discovered the thin clients actually had a bit of storage on them, so I installed Ubuntu MATE directly on the storage and booted them to the same result – it seemed that these particular clients didn’t like to work with Xorg without further configuration. At this point, it was the last chance I’d get to work on the system before having to deliver the news to the executive. I pulled out an old (but reliable) HP DC7100 Pentium 4-based computer we used to use as public computers, and set it up to boot (the first picture in this article shows the computer with the top of the case off) from network and voila, it successfully booted to the LTSP login screen.

À nouveau, si vous construisez une image 64-bit, remplacez i386 par amd64 dans la ligne :

pxe-service=x86PC, “Boot from network”, /ltsp/amd64/pxelinux

Une fois dnsmasq paramétré, je n'avais qu'à redémarrer le service dnsmasq et démarrer les clients légers (mais je me suis trompé). Pour redémarrez dnsmasq, lancer :

sudo service dnsmasq restart

J'ai allumé les clients légers, ils ont commencé le démarrage à partir du réseau et le téléchargement de l'image Ubuntu MATE et, finalement, je me suis retrouvé à regarder un écran noir… Après avoir fait quelques recherches, j'ai découvert que les clients légers avaient en fait un peu d'espace de stockage. J'ai donc installé Ubuntu MATE directement sur le stockage et les ai démarrés pour aboutir au même résultat ; j'avais l'impression que ces clients précis ne voulaient pas fonctionner avec Xorg sans configuration supplémentaire. À ce moment-là, c'était la dernière occasion que j'aurais pour travailler sur le système avant de devoir mettre le responsable au courant de tout. J'ai pris un vieux (mais fiable) ordinateur HP DC7100 basé sur Pentium 4 que nous utilisions comme un ordinateur à disposition du public, je l'ai paramétré pour qu'il démarre à partir du réseau et voilà, il a démarré sur l'écran d'accueil de LTSP (la première image de cet article montre l'ordinateur mis à nu).

7

Now I was left wondering “what’s the default login username and password?” Google might be your friend, but it wasn’t mine that night until it dawned on me just to use the credentials I used to set up the server - and it worked! The next problem I ran into was that when I ran /sbin/ifconfig on the client computer it displayed the I.P. address of the server. This didn’t make sense at first because I thought it should display the an address unique to the client. I thought I’d done something wrong when in fact things were working exactly as they should be. Once the client logs in to the server it actually is using the resources of the server and the proxy we set up was working as it should be. The clue that things were working correctly happened when I rebooted and noticed that each client does indeed get a unique I.P. address that’s displayed in the bottom right of the LTSP login screen. The last problem I ran into was the fact I was using the LTSP server administrator credentials to log in to the server. When I went to shut down the client, and typed in the server admin credentials, I also shut down the server. To fix the problem I added a non-administrative account to the server. Clients would use this non-administrative account to log in. But as hinted at earlier, when you make changes you want incorporated into your image you have to rebuild: sudo ltsp-update-image sudo sed -i 's/ipappend 2/ipappend 3/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default

Et alors, je n'avais qu'à savoir « le nom d'utilisateur et le mot de passe par défaut pour se connecter » ! Google est sans doute votre ami, mais il n'était pas le mien cette nuit-là jusqu'à ce que l'idée me soit venue : me servir tout simplement des identifiants choisis lorsque j'ai configuré le serveur - et cela a fonctionné ! Le problème suivant auquel je me trouvais confronté était que, quand je lançais /sbin/ifconfig sur l'ordinateur client, il affichait l'adresse IP du serveur. Je ne comprenais pas au départ, car je pensais qu'il devrait afficher une adresse unique au client. Je croyais avoir fait une erreur alors que, en fait, tout fonctionnait comme il fallait. Une fois que le client se connecte au serveur, il utilise les ressources de celui-ci et le proxy qu'on avait configuré fonctionnait bien. L'indice qui m'a aidé à reconnaître que tout fonctionnait bien, est apparu quand j'ai redémarré et remarqué que chaque client avait bel et bien une adresse IP unique qui s'affichait en bas à droite de l'écran de connexion de LTSP.

Le dernier problème que j'ai eu était que j'utilisais les identifiants de l'administrateur du serveur LTSP pour me connecter au serveur. Quand je voulais éteindre le client en saisissant les identifiants de l'admin du serveur, j'éteignais le serveur aussi. Pour résoudre le problème, j'ai ajouté un compte non-administrateur au serveur. Les clients l'utiliseraient pour se connecter. Mais comme évoqué auparavant, quand vous faites des changements que vous voulez incorporer à l'image, il faut la reconstruire :

sudo ltsp-update-image

sudo sed -i 's/ipappend 2/ipappend 3/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default

8

These commands need to be run every time you want to rebuild the client image based on a change on your server. Remember to replace the i386 with amd64 for 64-bit images. I found myself updating the image several times before I got it to a point where I thought I had the right mix of software for the community centre. After work one evening, I headed to the community centre with one of the executives to install the server. The centre had already taken 3 clients. The centre still didn’t have a wired Internet connection, but we set up the network and ran through some of the installed programs so they could get their members started learning keyboard skills (klavaro, I found tuxtyping to be too slow on the clients). When the centre gets a wired connection, I’ll be revisiting them to reconfigure their server for whatever router is giving them DHCP (I’ll add a DHCP reservation for the server on the router). At that point, it will also be necessary to update the ltsp ssh keys, and update the image: sudo ltsp-update-sshkeys sudo ltsp-update-image sudo sed -i 's/ipappend 2/ipappend 3/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default

Vous devez lancer ces commandes chaque fois que vous voulez refaire l'image client basée sur une modification sur le serveur. Rappelez-vous qu'il faut remplacer le « i386 » par « amd64 » pour des images 64-bit. Je me suis vu mettre l'image à jour plusieurs fois avant de la juger convenable : l'exacte variété de logiciels pour le centre communautaire.

Après le boulot, un soir, je suis allé au centre communautaire avec l'un des cadres pour installer le serveur. Le centre avait déjà récupéré 3 clients. Il n'avait toujours pas de connexion Internet filaire, mais nous avons paramétré le réseau et essayé certains des programmes installés pour que les membres puissent commencer à acquérir des compétences au clavier (klavaro, car je trouvais tuxtyping trop lent sur les clients). Quand le centre aura une connexion filaire, j'y retournerai pour configurer leur serveur pour le routeur qui leur fournit le DHCP (j'ajouterai une réservation DHCP pour le serveur sur le routeur). À ce moment-là, je devrais également mettre à jour les clés ltsp ssh, puis l'image :

sudo ltsp-update-sshkeys

sudo ltsp-update-image

sudo sed -i 's/ipappend 2/ipappend 3/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default

9

It’s exactly the same process for updating the image with the exception of updating the ltsp ssh keys first. I’ve asked the community centre executive to keep me in the loop to help members, and a person of their choosing with training to administer the server. The centre hasn’t officially opened at the time of this article, so I expect I’ll have a lot more to write about in a future article. It’s worth noting that I didn’t have a problem playing sound on clients, but ran into issues with USB devices. Initially I couldn’t get USB devices recognized on the clients. With some searching, I managed to fix the problem, but then ran into the problem of not being able to get the drives to unmount without administrative privileges. I also tried a system with a Core i5 processor as a client, and was surprised to find that it wasn’t that much faster – slightly faster to boot, but not much of a discernable difference running software (because the server is handling almost all of the load). LTSP resources: LTSP home page: http://www.ltsp.org/ Ubuntu LTSP community help: https://help.ubuntu.com/community/UbuntuLTSP Bobby Allen’s blog: http://blog.bobbyallen.me/2015/07/19/setup-a-ubuntu-14-04-lts-mate-terminal-server-with-ltsp/ Enabling USB and other local devices: https://wiki.ubuntu.com/EnableLTSP5LocalDevices

Le processus est exactement le même que celui de la mise à jour de l'image, sauf qu'il faut d'abord mettre à jour les clés ltsp ssh.

J'ai demandé au cadre du centre communautaire de me tenir au courant si je peux aider les membres, ainsi qu'une personne choisie par eux avec les connaissances nécessaires pour administrer le serveur. Au moment où j'écris ces lignes, le centre n'est pas encore ouvert officiellement ; je pense donc que j'aurai beaucoup de choses à dire dans un article prochain. Je vous signale que la lecture des média audio sur les clients ne me posait aucun problème, alors que j'ai eu des ennuis avec des dispositifs USB. Au départ, quoi que je fasse, les clients ne voulaient pas reconnaître les dispositifs USB. Après pas mal de recherches, j'ai pu résoudre le problème, pour réaliser ensuite qu'il était impossible de démonter les disques sans les droits d'administrateur.

J'ai également essayé un système avec un processeur Core i5 en tant que client, et fus surpris de constater qu'il n'était pas plus véloce que cela, un peu plus rapide au démarrage, mais sans grande différence en exécutant des logiciels (parce que le serveur gère la quasi-totalité de la charge).

Ressources LTSP :

Page d'accueil LTSP : http://www.ltsp.org/

Aide communautaire Ubuntu LTSP : https://help.ubuntu.com/community/UbuntuLTSP

Le blog de Bobby Allen : http://blog.bobbyallen.me/2015/07/19/setup-a-ubuntu-14-04-lts-mate-terminal-server-with-ltsp/

Activer des dispositifs locaux, notamment ceux sur USB : https://wiki.ubuntu.com/EnableLTSP5LocalDevices

issue109/labolinux2.txt · Dernière modification : 2016/06/07 15:04 de d52fr