Running Raspberry Pi’s as Thin Clients with Ubuntu 14.04 LTS

http://www.uzerp.com/blog/running-raspberry-pis-as-thin-clients-with-ubuntu-14-04-lts/

 

Running Raspberry Pi’s as Thin Clients with Ubuntu 14.04 LTS

Posted by Harry Lavender on September 10, 2014

This blog post will show exactly how to set up an LTSP server, running the latest version of Ubuntu, usable by Raspberry Pi thin clients over an Ethernet network, and manage these thin clients using centrally managed software known as Epoptes. This configuration is currently in use in our company setup.

This guide aims to get LTSP running on a network, with thin client access from a Raspberry Pi, as easily as is possible. Please note: This guide assumes that you can confidently install a server with Ubuntu 14.04LTS.

Requirements

  • Raspberry Pi (B model works best)
  • 512MB+ SD Card
  • Hardware to install Ubuntu 14.04 LTS on (Core2Duo+ is recommended, and a typical C2D system with 4GB of RAM will easily support 10 users). Note: This example uses a simple system that does NOT require 2 Network Interface Cards, meaning you can use a simple home PC as an LTSP server.
  • Copy of 14.04LTS
  • Network with a non-authoritative DHCP server (The LTSP server needs to be the DHCP Server here)
  • Keyboard/Mouse/Monitor for the Raspberry Pi, it obviously needs to be networked too.
  • SD Card Reader/Writer
  • A copy of BerryTerminal: http://www.berryterminal.com/doku.php

Advantages over Pi-LTSP

  • Isn’t a fat client.
  • Can run applications that otherwise could not be run on the Pi (Firefox, LibreOffice), whatever you can get working over LTSP that works on your distro..
  • You can mix this up with normal x86 or x64 clients, so if you have a few old Pentium 4 machines sitting around that work, you can use them too. (128MB of RAM is plenty for a thin client).

Installing and configuring the Operating System

Firstly, we need to install Ubuntu 14.04LTS. Download whichever flavour you would like, for this example I will be using standard Ubuntu 14.04 LTS Server. Note: if you are using the Server ISO, you will need a 64bit machine, as no 32bit server image is available.

I am using the standard Ubuntu 14.04LTS, as it has the bare minimum you need for this project, and anything extra that is needed, can be installed. I am not a fan of removing loads of unnecessary packages once the system is up and running. Make sure to install SSH during setup.

Once you have a vanilla server setup, or whatever flavour you happen to be using, we need to do the following, to ensure the system is fully up-to-date:

:~$sudo apt-get update
:~$sudo apt-get upgrade

Depending on your connection speed to the internet, that could have taken anywhere up to 10 minutes (Thanks ADSL). Once you’ve drained your coffee mug, we’re onto the next step.

Prepare packages that people need

I don’t know what you’re going to need for your users to use, whether it be OpenOffice or whatever, but I’ve included packages that are useful, and that we use here.

:~$ sudo apt-get install gnome-desktop-environment

The above installs Gnome3, which includes loads of packages, and most importantly a window manager, pretty essential for this project, as end users aren’t going to want to use busybox! This install is around 2GB, so you might need to slam down some more coffee while this does it’s thing. Feel free to install your favourite desktop environment. This obviously isn’t needed if your distro already comes with one.

Once you have saturated your bloodstream with caffeine, we now need to reboot the server. So go ahead and do:

:~$ sudo reboot now

You’ll end up with a GUI now, instead of bash or tty3 or whatever. You can either do everything from the terminal emulator on the server, or via SSH, it really doesn’t matter.

Now, onto the installation of the LTSP server:

:~$ sudo apt-get install ltsp-server-standalone

Once the above is done, we need to build the LTSP image, for deployment to our raspberry Pi’s.

:~$ sudo ltsp-build-client --arch i386

Make sure that the above is set, as this ensures that the images are built for an x86 system. I’m not too sure whether this actually matters, because obviously the Pi is neither x86 or x64, and berryterminal uses RDP. But best to make sure.

Please note, this will take a while, as it has to download the dependencies and libraries for the 32 bit version. It’s probably not a good idea to have any more coffee, or you might end up in hospital, so maybe take a minute out and have a glass of water.

Configuring Networking

That took a while. Now, let’s edit /etc/networking/interfaces, and set the network configuration to static, as I forgot to set it to static during install. If you managed to set it manually, congratulations. If you’re not sure, do the following:

vim (use whatever you want) /etc/networking/interfaces, and change the lines:

iface eth0 inet dhcp

To

iface eth0 inet static address xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.xxx

Obviously replacing x’s with the IP you want to give the server. Bear in mind you’ll need to edit the DHCP config after this, otherwise the DHCP server will not start for obvious reasons.

For this example I have used:

address 192.168.1.1 netmask 255.255.255.0 gateway 0.0.0.0 (No need for internet access).

Now, we need to go and modify the DHCP configuration file to make sure we are allocating the correct IP addresses.

Below is my dhcp.conf. You can see below that I have added in the MAC address of my Raspberry Pi, and given it an IP. You can use this format, or let it assign the Pi, or whatever device an IP from the specified DHCP range. I find it much easier to use statically assigned IP addresses. Also, if you plan on using this in a multi-server environment, then you must specify the server’s MAC addresses here. LTSP has to be the authoritative DHCP server, else it won’t work. If, for some reason, you cannot have LTSP as your DHCP server, you will have to use LTSP-PNP instead.

# # Default LTSP dhcpd.conf config file. # #rPi  host rPi1 { hardware ethernet 08:00:27:8E:12:5D; fixed-address 192.168.1.6; }  authoritative;  subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.20 192.168.1.250; option domain-name "example.com"; option domain-name-servers 192.168.0.1; option broadcast-address 192.168.1.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";   } }

As you can see above, I have amended the file to reflect the changes I made to /etc/networking/interfaces. I haven’t bothered to change option routers and the like, as this was setup as a VLAN for this tutorial.

Configuring the Raspberry Pi

Now, we need to sort out our Raspberry Pi. Installation of BerryTerminal is trivial, navigate your favourite browser to http://www.berryterminal.com/doku.php, and grab a copy of the .zip. As you’ll see on the site, all you need to do to install BerryTerminal is copy the contents of the .zip onto a FAT formatted SD card.

As you can see on the site, there are some extra options you can set, like auto login. I have shamelessly pasted them below.

Options

You can add the following special options to the file cmdline.txt located on the SD card:

server=1.2.3.4

Specifies the IP-address of the LTSP server.

KBLAYOUT=fr

Sets the keyboard layout (French in this example)

DM_AUTOLOGIN=True LDM_USERNAME=username12 LDM_PASSWORD=password

Automatically logs in to the server.

NOTE: each Berryterminal needs to have its own username.

LDM_LANGUAGE=fr

Sets the language

The options need to be appended on the same line as the existing options.

Now, as the .zip and it’s contents are only 30MB, you can choose the smallest SD card that will fit 30MB!

Create users and install epoptes

Now, we need some users. You can either use something like NIS, to export the users to the LTSP server, if you have a central file server using NFS for example. That is a lot of work, and if there is interest, I will write another tutorial on how to do this.

For now, I am going to create some local users, and make sure that they can log on, and that they can be managed by epoptes. (I’m sure you can actually add users to a *nix system, but hey!)

:~$ sudo adduser mrblobby

Now, obviously we have a user called mrblobby, once you’ve given him a password and the like.

Now, to manage the users, I use epoptes. Check out their site here: http://www.epoptes.org/

Epoptes provides lots of nice functionality, like grouping users, remote viewing and control via VNC, along with network booting, message sending and so on. It’s a fantastic piece of software in my opinion.

So, to install this beauty, we need to do the following on our LTSP server:

:~$ sudo apt-get install epoptes-client

This is actually quite confusing, well at least it was for me when I first set this up. The client needs to be on whatever device you are trying to manage, and the epoptes server, called epoptes, needs to be on whatever you are going to manage the LTSP server from. So, in our setup here, at Severn Delta, as the lone sysadmin I have the server package installed on my machine, and the client on the LTSP server, so that I can manage our users. I suppose you could install it onto a server used for managing the LTSP server, or you could install it onto the LTSP server, then manage it from a thin client.

So now we need to install the server:

:~$ sudo apt-get install epoptes

And add a user to the group that is authorised to use the program:

:~$ gpasswd -a username epoptes

Finally, we will need to rebuild the LTSP image, so that it includes epoptes-client.

:~$ sudo ltsp-update-image

Does it work?

Plug your raspberry Pi into the network, attach a keyboard and mouse. Finally, insert the SD card, and insert the power. If all is well, you will see the IP being assigned, and the image being downloaded, followed by you being spat out at a LTSP screen, at which you can log on.

Conclusion

If all is well, you now have amazingly cheap thin clients. I’d recommend looking into VESA mountable cases, which have SD covers on them, so naughty people can’t steal your SD cards when you put these into production environments.

If there is interest, I might write some more tutorials on the following LTSP related topics:

  • Locking down Gnome3, so that users do not have access to programs such as a terminal emulator, or a restricted program.
  • NIS users and file sharing, linking into a LTSP server, allowing for fat and thin client users, and remote storage. (Requires 2 servers)
  • Enabling RDP access to other machines from inside LTSP.
  • Network boot, and how to make it work with Epoptes.
  • Default session in LTSP, and menu customization.

Did this work for you? Follow us at on Twitter at @uZERP, or follow me at @HarryLavender