Linux Terminal Server

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
340
Reaction score
367
Credits
11,754
A Terminal Server is a server that can provide the Operating System to the workstations. In most cases, the workstations are diskless and have no means to install an Operating System (OS).

Basically, on the Linux Terminal Server, there are images created that are used by the client systems. You can create an image with all installed applications, wallpaper, etc. Each system will then use this image as if it were a live-CD image. The image is read-only and you must update the image when you need another program or an Operating System update.

NOTE: The workstations do not need to be diskless. If a hard drive is present in a system, then it can store the user’s data files, such as documents.

Terminal Server Background

The Linux Terminal Server is managed by the Linux Terminal Server Project (LTSP).

The Operating Systems that LTSP can use are Debian based versions of Linux. Ubuntu works well. In this article, I will use Ubuntu 22.04 as the Operating System being used as the OS for the workstations. LTSP works with Debian Jessie (8.11) and onward.

The Terminal Server needs to have a high-speed CPU and use a Gigabit network. Speed for the server and network speed are imperative for good functionality. If the Server or network is slow, then the workstation will appear as if it were slow.

When the workstation starts, it connects to the network using PXE to network boot, gets an IP Address from a DHCP Server, connects to the LTSP Server and access the OS image.

At the end of the article, I will cover how to VirtualBox to emulate a Diskless workstation to access the LTSP Server. If you have a spare system that supports network booting, you can use it instead.

LTSP Installation

The system you use needs to be a Desktop version of Ubuntu, or Debian, not a Server version. Install the OS as normal.

On my LTSP Server, I installed Ubuntu 22.04 as my base OS. After the installation completed, I performed the following to update the system:

sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove -y


Once you complete the updates, you’ll need to add a Personal Package Archive (PPA) so you can then install the LTSP files needed. To add the PPA, perform the following command in a Terminal:

sudo add-apt-repository ppa:ltsp

It should prompt you to press ‘ENTER’ to add the new PPA to the repository. Once you’ve added the PPA to the repository, then a package update should be automatic.

To install the actual program files, you need to perform the next command:

sudo apt install --install-recommends ltsp ltsp-binaries dnsmasq nfs-kernel-server openssh-server squashfs-tools ethtool net-tools epoptes cfs-tools nfs-common -y

You’ll need to specify a user account that will administer the LTSP with the command:

gpasswd -a <user> epoptes

Replace ‘<user>’ with the user account you want to use. The command will add the specified user to the group named ‘epoptes’. You can add multiple names to have multiple people allowed to manage the LTSP portion of the server.

If you do not have Oracle VirtualBox installed on the server, then you should also perform:

sudo apt install virtualbox-guest-utils -y

The VirtualBox Guest Utilties are needed only if you plan to use VMDK files as an image for clients.

For most networks, there is a separate device working as a DHCP Server. Here, you need to run the following command to set up network configuration:

ltsp dnsmasq

NOTE: If an error occurs that DNMASQ failed, then perform:

sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
sudo systemctl mask systemd-resolved
sudo systemctl restart ufw
sudo systemctl start dnsmasq
sudo systemctl enable dnsmasq


Run ‘ltsp dnsmasq’ and it should execute fine now.

The next command is used to set up the Network File System (NFS) so the server can share the images over the network:

ltsp nfs

The next command will compress various folders that are transferred to the clients as an additional initrd for booting. The folders are:

/usr/share/ltsp, /etc/ltsp, /etc/{password,group} and the server public SSH keys into /srv/tftp/ltsp/ltsp.img

It makes the compression from the command:

ltsp initrd

This configures LTSP as needed, but we still need to create an image to share with the clients.

Image Creation

There are two ways to create images I will cover. The first is to image a machine that you have LTSP installed. The second way is to create an image from a VirtualBox Machine.

For the first step of image creation, you can use your LTSP Server or even another system that you installed LTSP on.

NOTE: Keep the system in one partition, do not create multiple partitions for the Boot, Swap, Home, etc.

Get Ubuntu or Debian installed with all the apps you want the client workstations to use on the systems. Make all settings you want to be saved, such as wallpaper, etc.

Keep in mind that you’ll need to set up all users and groups on this system. Any users that log in under the same username will share the same Home Folder on the LTSP Server.

Users can install new apps from the repositories if the systems have access to the Internet, but it will not change the image stored on the LTSP Server.

Once the system is completely setup, run the command:

ltsp image /

We will place the image in the folder ‘/srv/ltsp/images/x86_64.img’.

Any systems that connect to the LTSP Server will not have an option for any images when the boot screen appears.

To generate the menu and include any images in the ‘/srv/ltsp/images/’ folder, you need to run the command to generate the menu:

ltsp ipxe

Keep in mind, whenever you add a new image, or a name changed, run the ‘ltsp ipxe’ command, or the menu will not be updated.

If you want to use VirtualBox, you can use a separate system, but you need to have the system set up as an LTSP Server so you have the command ‘ltsp’.

From VirtualBox, set up the image as normal, keep the machine name simple. The Drive needs to be set as a VMDK drive. Keep the size down as much as you can. Try 8-15 GB in size. Do not make it an extreme amount that you do not need. Set the drive as a ‘Fixed Drive’. Leave the default memory size and one CPU. Enable 3D acceleration. Set the Network Adapter as ‘Bridged’ if you want to update the OS.

NOTE: In most cases, during the initial setup, leave all the defaults. Increase nothing unless you absolutely need it. When you update the system later, when it might be needed, and you need more space in the storage drive, you can increase it.

Once you create the image, exit the OS appropriately and close VirtualBox.

From a Terminal, run the following command:

sudo ln -s “/home/<user>/VirtualBox Vms/<machine name>/<machine name>-flat.vmdk” /srv/ltsp/<machine name>.img

Do note that you’ll need to specify the name of the user’s home folder as well as the machine name you gave the Virtual Machine. The VMDK image ends with ‘-flat’, so make sure you include in the command or you’ll get an error. You can change the ‘<machine name>.img’ to another filename as you want, but keep the extension as ‘.img’. Keep the name simple yet at this point.

NOTE: If you changed the default location to the Virtual Machines, then you’ll need to change the folder location as needed.

The command creates a link to the VMDK file to the folder ‘/srv/ltsp/’. You can copy the VMDK to the folder, renaming it ‘.img’, but the link works much faster.

Now, like imaging the LTSP Server, you need to create an actual image, so use the command:

sudo ltsp image <image name>

The name you specify here will be the one that will appear on the menu that is seen on the workstations.

NOTE: Before you run the ‘ltsp image’ command, make sure that no other images, or links, exist in the folder ‘/srv/ltsp/’. If other images or links exist, remove them. If you don’t, the ‘ltsp’ command can generate an error, or it may image all links.

Once you generate the image, then you can remove the link. If you need to, at any point, load the Virtual Machine again, make all changes you need and redo the last two steps to generate a new image. Make sure you give it the same name, or you will end up with multiple images that you may not need.

Diskless Workstation

If you do not have diskless workstations, or even ones with disks, you can access the LTSP Server with a Virtual Machine in VirtualBox using a PXE Network Boot machine. The machine will emulate a diskless workstation as if it were a real physical system.

NOTE: You can add a virtual disk to the workstation, but we will place no OS on it. Users can store files locally that they create from apps on the imaged OS.

Create a new machine. Select the OS Type as ‘Other’. Set the Version to ‘Other/Unknown (64-bit)’. Once you make the initial machine, set the following:

  • System – Uncheck all Boot Devices and check Network
  • Display – Set Video Memory to 128 MB
  • Display – Enable 3D Acceleration
  • Storage – Remove all devices
  • Network – Set to Bridged

Start the machine and it should start a PXE Boot. As long as you have a DHCP Server to issue the system an IP Address, then it will get an address and find the LTSP Server. Once the system finds the LTSP Server, it will show an initial menu (Figure 1) and give you 5 seconds to select an option. If we do not make a choice in 5 seconds, the system loads the default image. The menu is the basic GRUB menu that was created by the command ‘ltsp initrd’.

Figure 1.JPG

FIGURE 1

After a user makes a selection, the system loads the image from the LTSP Server and treated like a Live CD.

Now you can test your image and verify it has everything you need.

Conclusion

For a large roll-out of systems that may cost too much, this option can help cut down on machine expenses. Some diskless systems can cost a few hundred dollars and require less maintenance that a standard system.

I have seen some libraries with 10-20 systems that use an imaging system similar to a Terminal Server. Just keep in mind, you need a very good high-end server and a fast network for this to work well.
 

Staff online

Members online


Latest posts

Top