This article will help you compile software for thin clients. Using a thin client, users can connect to RDP/Citrix/VMview services and other protocols. The author used CentOS 8, Server edition, for the compilation.
Thinstation
Thinstation 6.2 is a Linux distribution that boots on a thin client (USB/HDD/PXE). It’s a stripped-down Linux, with almost everything removed except networking utilities. A single CPU and 2 GB of RAM are sufficient to run the distribution. For older computers, Thinstation 5.1 is a good choice, requiring only 512 MB of RAM.
Preparing packages
Since Centos 8 already has chroot pre-installed, there are no other dependencies before installation.
Downloading source code
The thinstation repository is about 1.3 GB, so if you have a slow internet connection, be patient.
cd /opt
git clone --depth 1 git://github.com/Thinstation/thinstation.git
cd thinstation Configuration
After downloading the thinstation repository, we need to build a chroot environment. This takes about 10-15 minutes.
./setup-chroot Once in the chroot environment, you need to prepare the configuration files required to build the thinstation image.
There are several assembly options:
iso syslinux pxe refind grub In our case, we will only compile the pxe version.
First, you should remove the link from build.conf to build.conf.example so as not to lose the original conf file, from which you can retrieve the original settings in case of errors.
cd build
rm -rf build.conf
cp build.conf.example build.conf Let’s go over the general parameters in the build.conf file.
nano build.conf The hardware module is responsible for selecting preset configurations for PCs or thin clients. It will be needed later.
machine MyMachineName Wi-Fi configuration
If your device has Wi-Fi, you should enable wpa_supplicant
package wpa_supplicant
File system support
To further expand the functionality, we will include the cifs, nfs, and ntfs modules.
module usb-storage
module isofs # ISO9960 file system support for CDRoms
module udf # CDRom UDF file system support
module vfat # Fat and VFat file system support
module ntfs # NTFS file system support
module ext4 # Ext4 file system support
module nfs # NFS file system support
module cifs # CIFS support (use either this or smbfs - not both) We activate netfiles to load additional configuration files via tftpd/http, which we will use later for ease of administration.
package netfiles Since in our case we will not be using the desktop on thin clients, we will remove all unnecessary localizations except English.
package locale-en_US # English-US It’s time for applications.
In my case, I only need freerdp, since all we’ll be doing is connecting to the server via RDP.
package freerdp # X RDP Client - fork of rdesktop
#package rdesktop # X RDP client for Windows Terminal Services (ver 1.7)
#package vncviewer # VNC client (vncviewer)
#package xorg7vnc # Remote Control Client Workstation
#package ica # Citrix ICA client support
#package tarantella # Tarantella client support
#package xnest # XDM in a window client
#package urxvt # Light Xterm Client (vt102)
#package xterm # Xterm Client (vt220)
#package ssh # Secure Shell client
#package tn5250 # 5250 terminal emulator
#package dillo # Dillo light web browser
#package thinlinc # Cendio ThinLinc client support
#package nx # No Machine NX client
#package 2x # 2X client
#package spice # Redhat Spice Client
#package java # Java runtime
#package firefox # Firefox current Web Browser
#package chrome # Google Chrome Web Browser
#package chromium # Chromium Web Browser
#package kiosk # Rkiosk Plugin for Firefox
#package flash # Flash Current
#package filezilla # FileZilla FTP Client for X
#package git # GIT Version Control System
#package gparted # Gnome Partition Manager
#package open-vm-tools
#package vboxguest
#package medit # Notepad
#package mplayer # DVD and video player
#package vmview # VMware Open-View Client, PCOIP
#package xbmc # XBMC Media Center for X
#package evince # X PDF Viewer
#package openkiosk # OpenKiosk is a cross platform kiosk web browser based on Mozilla Firefox
#package xdmcp-connect # Simple connection to XDMCP server Enable the www package for remote access to a thin client (This may be useful)
package www
package lighttpd
The next step is to change passwords and select the boot mode.
If fastboot mode is enabled, a separate file will be generated that will be loaded from the booted OS. Roughly speaking, this is the /lib directory compressed into squashfs.
Otherwise, all files will be added to the initrd image.
param fastboot true # Mangles the filesystem a special way as to improve boot speed and reduce
# memory utilization. Cool/Dangerous . Harder to dubug other packages. (Finishing Touch)
# Set to 'true' to enable or 'lotsofmem' for slightly slower booting but no squash lag on app launch.
param tsuser tsuser # Name of the user that thinstation will run as. Needs userauto package.
param tsuserpasswd pleasechangeme # Do Change! Console/telnet password for non-root
param rootpasswd pleasechangeme # Do Change! Console/telnet password for root
# If this is enabled, Telnetd will be enabled.
param tsadminpasswd pleasechangeme # Admin password of web interface
param xorgvncpasswd pleasechangeme # VNC Access Password
param storagepasswd pleasechangeme # Password for storage server
param dialuppasswd pleasechangeme # Password for dialin account
param sambapasswd pleasechangeme # Password for samba shares when using user mode security Additional settings
param bootresolution 1920x1080-32
param desktop file:./backgrounds/Hive_Lite.jpg # Custom image to load as desktop background
param defaultconfig thinstation.conf.buildtime # The file with default setup. No other config file is found
# during boot.
param basename thinstation # тут нужно указать имя файла для получения дополнительных файлов настроек
param basepath conf # тут нужно указать каталог для получения дополнительных файлов настроек
param baseurl 'http://${SERVER_IP}' # Used to determine url to wget/http files - if you wan't to use a web server on the same server as the TFTP server
param sametimestmp true # When enabled, the timestamps for all files and folders will be set to 00:00 of todays date in your timezone
param initrdcmd "gzip -9" # поправим gzip на более сильную компресию
param bootverbosity 3 # Increased vebosity when booting TS
param downloads /downloads
param bootimages "pxe" # сборка только PXE версии
param bootserver "192.168.1.1" # Указываем IP адрес сервера TFTPD64 Comment out the lines that will install all modules.
#param allres true # Includes a lot of resolution splash images for live-cd s
#param allfirmware true # Includes a lot of firmwares for live-cd s
param earlymicrocode false # Builds microcode initramfs for early loading Here’s our final configuration file, in which we’ve added xfwm4 for ease of use of the window manager. This can be useful for debugging. Next, we’ll use the configuration file to disable it.
<pre class="wp-block-syntaxhighlighter-code">machine MyMachineName
package wpa_supplicant
module usb-storage
module isofs # ISO9960 file system support for CDRoms
module udf # CDRom UDF file system support
module vfat # Fat and VFat file system support
module ntfs # NTFS file system support
module ext4 # Ext4 file system support
module nfs # NFS file system support
module cifs # CIFS support (use either this or smbfs - not both)
package netfiles # Adds only this package instead of the whole ts-classic. netfiles lets you get thinstation.conf.xxx files
package udisks
package automount
package autonet
package ntp # Utility to obtain date & time from network
package alsa
package gnome-control-center
package volumeicon
package cpufreq
package xorg7-vesa #A fallback driver that works with almost everything. Does allow resolution changes
package xorg7-vmware
package xorg7-intel #Intel video driver for most modern chipsets except the GMA3500/3600
package locale-en_US # English-US
package freerdp # X RDP Client - fork of rdesktop
package open-vm-tools
package xfwm4
package xfce4-power-manager
package terminal # Terminal emulator for xfwm4 -- Pulls in xfwm4
package thunar # File Manager for xfwm4 -- Pulls in xfwm4
package www # Web access to client. From a browser: "http://<IP number>"
package cups
package samba-client # Samba smbclient, gives a shell like environment to access an samba server
package gtk-2.0 # Full gtk-2.0 plus clearlooks theme
package gtk-3.0
package gtk-theme-adwaita
package icons-cursor # Anti Aliased Mouse Cursor Theme
package icons-hicolor # Hi-Color icons for some applications and themes. Does not really contain any icons.
package icons-adwaita
package fonts-TTF-BH # This one works nicely most of the time and is small.
package fonts-TTF-vera
package fonts-TTF-liberation
package fonts-TTF-noto
param fastboot false # Mangles the filesystem a special way as to improve boot speed and reduce
param tsuser tsuser # Name of the user that thinstation will run as. Needs userauto package.
param tsuserpasswd pleasechangeme # Do Change! Console/telnet password for non-root
param rootpasswd pleasechangeme # Do Change! Console/telnet password for root
param tsadminpasswd pleasechangeme # Admin password of web interface
param xorgvncpasswd pleasechangeme # VNC Access Password
param storagepasswd pleasechangeme # Password for storage server
param dialuppasswd pleasechangeme # Password for dialin account
param sambapasswd pleasechangeme # Password for samba shares when using user mode security
param bootlogo true # Enable or Disable the use of the Boot splash.
param boottheme default # Backgound picture during boot
param splash silent
param fbmtrr 0 # MTRR value for uvesafb (default = 0, 4 is the best) grep your log to make sure you have not set it to high
param fbsm ywrap # Window scrolling method (redraw, ypan, ywrap) ywrap is best, but may not work correctly for all people
param bootresolution 1920x1080-32
param desktop file:./backgrounds/Hive_Lite.jpg # Custom image to load as desktop background
param defaultconfig thinstation.conf.buildtime # The file with default setup. No other config file is found
param basename thinstation # Used for all config/tftp/scp file names
param basepath conf # Used to determine path to tftp/scp files
param baseurl 'http://${SERVER_IP}' # Used to determine url to wget/http files - if you wan't to use a web server on the same server as the TFTP server
param haltonerror false # Will halt on error, default is true
param hardlinkfs true
param sametimestmp true # When enabled, the timestamps for all files and folders will be set to 00:00 of todays date in your timezone
param initrdcmd "gzip -9" # Compression mode and level of initrd file. none, gzip -9, lzma -9 ,bzip2 -9
param bootverbosity 3 # Increased vebosity when booting TS
param downloads /downloads
param bootimages "pxe"
param bootserver "192.168.1.1" # Used for the pxe image config files to specify where to download
param syslinuxtheme "default"
param grubtheme "default"
package alltimezone
param allres false # Includes a lot of resolution splash images for live-cd s
param allfirmware false # Includes a lot of firmwares for live-cd s
param earlymicrocode false # Builds microcode initramfs for early loading
param blacklist "snd-pcsp.ko pcspkr.ko"</pre> If you don’t yet know what hardware will be used on thin clients or it varies greatly —
then it’s worth compiling without creating machine configs and simply enabling all modules, skipping this step.
If you have only one device model, and/or if your knowledge of Linux doesn’t allow you to simply specify which modules (drivers) you need, then you should compile a default image with the following parameter added:
package extensions-x and run compilation
./build --allmodules Then, you need to take the iso from the boot-images/iso directory, unpack it onto a flash drive, and load it on the client.
After connecting via telnet, run the hwlister.sh command, which will generate the files required to create a personal config (tftp is required).
Now we move on to creating the machine.
cd machine
mkdir MyMachineName
cd MyMachineName
cp /tftp_server/*.list . Let’s configure the user’s destination after Thinstation boots, in terms of environment. These settings are made in the thinstation.conf.buildtime file.
cd ../..
nano thinstation.build.conf We’ll install Timzone and the option to download additional configurations from a TFTP server, as well as remote access from any IP address.
TIME_ZONE=Asia/Tashkent
NET_REMOTE_ACCESS_FROM=0.0.0.0
NET_FILE_ENABLED=On Compilation
Now that all our configs are ready, let’s start building.
cd ../../
./build
We move everything from the ./boot-images/pxe/ directory to the tftp directory
cp -rf ./boot-images/pxe/* /tftp_server/ iPxe
iPxe is used for network booting using TFTP HTTP and iSCSI protocols.
In our case, the iPXE boot image will be transferred via TFTP, which will in turn initiate the download of the initrd and vmlinuz files via HTTP. This will speed up the download, as TFTP is a relatively slow protocol and is generally not designed for large files.
Downloading source code
cd /opt
git clone git://git.ipxe.org/ipxe.git
cd ipxe Let’s prepare a file that will be loaded immediately after iPXE starts.
nano embed.ipxe
Let’s create a built-in configuration for receiving parameters via DHCP, including the boot image. In my case, the web server root and tftp are pointing to the same directory: /tftp_server/
#!ipxe
dhcp
chain http://192.168.1.1:8080/boot/efi64/boot.ipxe Compilation
We compile by specifying the path to our previously created iPXE file
cd /opt/ipxe/src/
make bin-x86_64-efi/ipxe.efi EMBED=../embed.ipxe Move ./bin-x86_64-efi/ipxe.efi to the tftp directory
cp -rf ./bin-x86_64-efi/ipxe.efi /tftp_server/ Running
Let’s prepare the catalogs for launch
cd tftp_server/boot
rm -rf ./efi32
rm -rf ./lpxelinux
rm -rf ./pxelinux
rm -rf ./efi64/*
cp ../../ipxe.efi ./efi64/ Let’s create a configuration file to load our image via IPXE.
nano ./efi64/boot.ipxe #!ipxe
kernel http://192.168.1.1:8080/boot/vmlinuz initrd=initrd
initrd http://192.168.1.1:8080/boot/initrd
boot TFTP
I used a router with a TFTP server. There are quite a few options for setting up a TFTP server. I would recommend tinyPXE for beginning administrators.
Let’s add options 66 and 67 to DHCP, which will tell the client the TFTP server address and the path to the boot image:
option 66 = 192.168.1.1 # Адрес TFTP сервера
option 67 = boot/efi64/ipxe.efi # путь к файлу загрузки Now that all the basic setup and configuration is complete, it’s time to try booting up your thin client and testing all your applications.
thinstation.conf.network
If the download is successful, we can move on to additional options. Specifically, setting up automatic connection to the RDP server.
To do this, you need to create a conf directory in the server root
cd /tftp_server/
mkdir conf
cd conf Let’s create a configuration file named thinstation.conf.network
nano thinstation.conf.network Let’s add server connection and autostart information to the file. You can read more about freerdp parameters here: https://github.com/FreeRDP/FreeRDP/wiki/CommandLineInterface
SESSION_0_AUTOSTART=ON
SESSION_0_TYPE=freerdp
SESSION_0_TITLE="RDP"
SESSION_0_FREERDP_SERVER="server-ip-addr"
SESSION_0_FREERDP_OPTIONS="/d:domain.org /bpp:32 /cert-ignore +fonts +aero"
RECONNECT_PROMPT=FORCE Save the file, restart the thin client, and voila! You’re done.
