How to Install and Configure Linux Terminal Server with ThinLinc on Google Cloud
Tags: rdp, remotedesktop, ssh
Published: 2023-03-27 17:00:32

ThinLinc is a cross-platform and one of the best remote desktop solutions for Linux. It allows users to access Linux applications and desktops from anywhere via a web browser and GUI client. ThinLinc is based on open-source software such as TigerVNC, OpenSSH, noVNC, PulseAudio, and CUPS. It also provides GUI clients for Linux, macOS, and Windows, and it can also be accessible from a web browser. 

In this guide, we will show you how to install and configure ThinLinc remote desktop server on the Linux operating system on Google Cloud.
 
## Requirements

* A Linux server running on Google Cloud Platform (In this tutorial, we will use Ubuntu 22.04 server)
* A root user or a user with sudo privileges
* An x86_64 CPU with enough RAM and disk space.
* An OpenSSH server is installed and configured.

## Getting Started

First, connect to your Ubuntu 22.04 server instance via SSH then update and upgrade all system packages with the following command.

    apt update -y
    apt upgrade -y

Once all the packages are updated, restart your server to implement the changes.

    reboot
           
## Install Ubuntu Desktop Environment

ThinLinc is designed to access the Linux desktop environment. So you will need to install any desktop environment (Gnome, XFCE, KDE, LXDE) on your server.

First, install the tasksel utility with the following command.

    apt install tasksel

Next, install the Desktop environment using the following command.

    tasksel install ubuntu-desktop

This process will take some time to finish the installation. Once the Desktop environment has been installed, restart your system to apply the changes.

    reboot
           
## Download ThinLinc Terminal Server

First, you will need to create a user on the Ubuntu server. You can create it with the following command.

    adduser james

Next, add the created user to the sudoer group so that it can perform administrative tasks.

    usermod -aG sudo james

Visit the ThinLinc server [download page](https://www.cendio.com/thinlinc/download/registration) and download the server package to your local system. After the successful download, you must copy the downloaded file to your Google cloud server inside the user's home directory.

Next, log in to your Ubuntu server via SSH as a james user and unzip the downloaded file.

    unzip tl-4.14.0-server.zip

## Install and Configure ThinLinc Terminal Server

Follow the below steps to install the ThinLinc server on the Ubuntu server.

**Step 1** - First, navigate to the ThinLinc extracted directory with the following command.

    cd tl-4.14.0-server

**Step 2** - Next, run the following command to start the ThinLinc server installation.

    sudo ./install-server

You will be asked to provide a user password to continue. After the successful authentication, you will see the server installation wizard.

    [sudo] password for james:
    Could not start GTK+. Using text mode fallback...
    Welcome to the ThinLinc Server Installation Wizard
    ==================================================
    This program will help you install the ThinLinc software 
    packages on your system.
    Before installing, please see the Platform Specific Notes 
    at https://www.cendio.com/thinlinc/docs/platforms
    Press Enter to continue...

**Step 3** - Press the Enter key to continue. You will see the list of packages to be installed on your server.

    Determining packages to install... done.
    The following packages will be installed:
    thinlinc-tlmisc_4.14.0-2408_amd64.deb
    thinlinc-tlmisc-libs_4.14.0-2408_amd64.deb
    thinlinc-tlmisc-libs32_4.14.0-2408_amd64.deb
    thinlinc-vsm_4.14.0-2408_amd64.deb
    thinlinc-vnc-server_4.14.0-2408_amd64.deb
    thinlinc-tladm_4.14.0-2408_amd64.deb
    thinlinc-tlprinter_4.14.0-2408_all.deb
    thinlinc-webaccess_4.14.0-2408_all.deb
    Press Enter to continue...

**Step 4** - Press the Enter key to continue. Once all the packages are installed successfully, you will be asked to configure the ThinLinc server.

    Performing package installation... done.
    All packages were installed successfully.
    The installation of ThinLinc has completed successfully
    Before using ThinLinc, you must configure it using
    /opt/thinlinc/sbin/tl-setup.
    Run ThinLinc Setup now [Yes/no]?

**Step 5** - Type Yes and press the Enter key. You will be asked to accept the license agreement.

    Could not start GTK+. Using text mode fallback...
    Welcome to the ThinLinc Server Setup Wizard
    ===========================================
    This program will configure ThinLinc to run on your 
    system. It will also verify that you have all required 
    software installed. Before continuing, please ensure you 
    have read the Platform Specific
    Notes at https://www.cendio.com/thinlinc/docs/platforms
    8.9 The Program(s) are not specifically developed or 
    licensed for use in any nuclear, aviation, mass transit 
    or medical application or in any other inherently 
    dangerous applications. Neither Cendio nor its
    suppliers shall be liable for any claims or damages 
    arising from such use and Licensee agrees to indemnify 
    and hold harmless Cendio and its suppliers from any 
    claims for losses, costs, damages, or liability arising 
    out of or in connection with such use of the Program(s).
    Do you accept the terms of the License Agreement 
    [yes/No]?yes

**Step 6** - Type Yes and press the Enter key. You will be asked to select the server type.

    Server Type
    ===========
    Please select the type of ThinLinc server to configure. 
    The master server is the one users will connect to. Agent 
    servers are used to spread the resource load when just 
    the master server is insufficent. If unsure, then pick 
    Master. Server type [Master/agent]?Master

**Step 7** - Type Master and press the Enter key to check all system requirements needed to install the ThinLinc server.

    System Check
    ============
    Please wait, analyzing system... done.
    Library and binary requirements
    ===============================
    ThinLinc requires a few libraries and binaries to work as 
    expected.
    This system lacks one or more of these.
    The necessary packages can be installed automatically by 
    this wizard, or you can install them manually and restart 
    the wizard.
    Press Enter to continue...

**Step 8** - Press the Enter key to install all the required dependencies.

    Resolving packages and dependencies... done.
    The following packages will be installed:
    postfix-3.4.13-0ubuntu1.2.amd64
    Press Enter to continue...
    Please wait, installing packages... done.
    All packages and their dependencies were successfully 
    installed.
    Press Enter to continue...

**Step 9** - Press the Enter key. You will be asked to install all packages for network file system support.

    Network File System support
    ===========================
    The Local Drive Redirection feature requires that your 
    system can act as a NFS client.
    The necessary packages can be installed automatically by 
    this wizard, or you can install them manually and restart 
    the wizard.
    Automatically install the necessary packages [Yes/no]?Yes

**Step 10** - Type Yes and press the Enter key to start installing all NFS packages. Once all of them are installed successfully, you should see the below output.

    Resolving packages and dependencies... done.
    The following packages will be installed:
    nfs-common-1:1.3.4-2.5ubuntu3.4.amd64
    The following dependencies will be installed/updated:
    libtirpc-common-1.2.5-1ubuntu0.1.all,
    libtirpc3-1.2.5-1ubuntu0.1.amd64, keyutils-1.6- 
    6ubuntu1.1.amd64,
    rpcbind-1.2.5-8.amd64, libnfsidmap2-0.25-5.1ubuntu1.amd64
    Do you want to continue with installation [Yes/no]?Yes

    Please wait, installing packages... done.
    All packages and their dependencies were successfully 
    installed.
    Press Enter to continue...

**Step 11** - Press the Enter key. You will be asked to install all Python modules need for LDAP integration. After installing all the required modules, you will get the following output.

    Python Dependency
    =================
    The Python LDAP module is required for LDAP integration 
    tools. Your system does not have this installed.
    The necessary packages can be installed automatically by 
    this wizard, or you can install them manually and restart 
    the wizard.
    Automatically install the necessary packages [Yes/no]?Yes
    Resolving packages and dependencies... done.
    The following packages will be installed:
    python3-ldap-3.2.0-4ubuntu2.1.amd64
    The following dependencies will be installed/updated:
    python3-pyasn1-modules-0.2.1-0.2build1.all,
    python3-pyasn1-0.4.2-3build1.all
    Do you want to continue with installation [Yes/no]?Yes

**Step 12** - Type Yes and press the Enter key. You will be asked to define an administrator email, username and password as shown below.

    Administrator Contact
    =====================
    Please enter your e-mail address. ThinLinc will send 
    administrative messages, for example license warnings, to 
    this address.
    Administrator email []? hitjethva75@gmail.com
    Web Administration
    ==================
    The ThinLinc web administration is running on port 1010 
    (https) on this server. To authenticate, you must have a 
    valid user and password.
    The default username is "admin". Please enter the desired 
    password for this user, or leave unchanged to skip this 
    step. Web administrator password?

**Step 13** - Provide your administrator Email, password and press the Enter key to install printer-related packages to your server. After the successful installation, you will get the following output.

    Printers
    ========
    ThinLinc includes special printer queues that allow users 
    to use printers locally attached to their client machine, 
    as well as automatically selecting the correct printer 
    based on the users' location. Would you like to have 
    these queues configured?
    Configure location based printer queue (nearest) 
    [Yes/no]?Yes
    Configure client-side printer queue (thinlocal) [Yes/no]? 
    no
    Please wait, configuring printer queues... done.
    The ThinLinc printer queues have been successfully 
    installed.
    Press Enter to continue...

**Step 14** - Press the Enter key. You will be asked to install AppArmor in your server.

    AppArmor
    ========
    This system is using the AppArmor access control system. 
    A ThinLinc configuration needs to be loaded for some 
    applications to operate correctly in this environment. 
    Would you like to install the ThinLinc
    AppArmor configuration?
    Install AppArmor configuration [Yes/no]?Yes

**Step 15** - Type Yes and press the Enter key to configure and start all ThinLinc services as shown below.

    Configuring Services
    ====================
    Configuring and starting ThinLinc services... done.
    All ThinLinc services have been configured and started 
    successfully.
    Press Enter to continue...

**Step 16** - Press the Enter key to complete the ThinLinc installation. You should see the following output.

    ThinLinc has been setup
    =======================
    The ThinLinc Web Administration is available at
    https://localhost:1010, and the configuration files are 
    located in /opt/thinlinc/etc/conf.d/. Icons for the 
    ThinLinc Web Access, ThinLinc Web Administration and 
    ThinLinc Setup have been added to the menu.
    Visit https://www.cendio.com/thinlinc/support for 
    information on how to contact us.

## Verify ThinLinc Services

At this point, the ThinLinc server is installed and configured on the Ubuntu server. Now, you will need to verify whether all ThinLinc services are running or not.
First, verify the vsmserver service using the following command.

    sudo systemctl status vsmserver

You should see the service status in the following output.

    ● vsmserver.service - ThinLinc VSM server
    Loaded: loaded (/lib/systemd/system/vsmserver.service; 
    enabled; vendor preset: enabled)
    Active: active (running) since Sat 2023-03-25 04:48:25 
    UTC; 1min 11s ago
    Process: 6218 ExecStart=/bin/bash --login -c 
    /opt/thinlinc/sbin/vsmserver (code=exited, 
    status=0/SUCCESS)
    Main PID: 6226 (python3)
    Tasks: 1 (limit: 4685)
    Memory: 12.9M
    CGroup: /system.slice/vsmserver.service
    └─6226 /opt/thinlinc/libexec/python3 
    /opt/thinlinc/sbin/vsmserver
    Mar 25 04:48:25 ubuntu systemd[1]: Starting ThinLinc VSM 
    server...
    Mar 25 04:48:25 ubuntu systemd[1]: Started ThinLinc VSM 
    server.

To check the vsmagent service status, run the following command.

    sudo systemctl status vsmagent

You should see the following output.

    ● vsmagent.service - ThinLinc VSM agent
    Loaded: loaded (/lib/systemd/system/vsmagent.service; 
    enabled; vendor preset: enabled)
    Active: active (running) since Sat 2023-03-25 04:48:25 
    UTC; 1min 36s ago
    Process: 6163 ExecStart=/bin/bash --login -c 
    /opt/thinlinc/sbin/vsmagent (code=exited, 
    status=0/SUCCESS)
    Main PID: 6189 (python3)
    Tasks: 1 (limit: 4685)
    Memory: 12.3M
    CGroup: /system.slice/vsmagent.service
    └─6189 /opt/thinlinc/libexec/python3 
    /opt/thinlinc/sbin/vsmagent
    Mar 25 04:48:24 ubuntu systemd[1]: Starting ThinLinc VSM 
    agent...
    Mar 25 04:48:25 ubuntu systemd[1]: Started ThinLinc VSM 
    agent.

To check the ThinLinc web service status, run the following command.

    sudo systemctl status tlwebaccess

If the service is in active state, you should see the following output.

    ● tlwebaccess.service - ThinLinc Web Access
    Loaded: loaded (/lib/systemd/system/tlwebaccess.service; 
    enabled; vendor preset: enabled)
    Active: active (running) since Sat 2023-03-25 04:48:26 
    UTC; 1min 52s ago
    Process: 6230 ExecStart=/bin/bash --login -c 
    /opt/thinlinc/sbin/tlwebaccess (code=exited, 
    status=0/SUCCESS)
    Main PID: 6239 (python3)
    Tasks: 1 (limit: 4685)
    Memory: 13.3M
    CGroup: /system.slice/tlwebaccess.service
    └─6239 /opt/thinlinc/libexec/python3 
    /opt/thinlinc/sbin/tlwebaccess
    Mar 25 04:48:25 ubuntu systemd[1]: Starting ThinLinc Web 
    Access...
    Mar 25 04:48:26 ubuntu systemd[1]: Started ThinLinc Web 
    Access.

## Configure  Firewall for ThinLinc Access

By default, the ThinLinc server uses the following ports:

* 22 - SSH connection
* 300 - Web Access
* 9000 - ThinLinc Client Access
* 1010 - ThinLinc control panel access

For ThinLinc remote desktop access, you need to open these three ports on your Google cloud server. You can open them via the Google cloud firewall control panel.

## Access ThinLinc Via Web Browser

Open your web browser on your local system and access the Ubuntu remote desktop using the URL **https://your-server-ip:300**. You will be redirected to the Ubuntu desktop login screen.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wf9gp820ksjz3znkmb6b.png)

Provide your Ubuntu username, password and click on the **Login** button. After the successful login, you should see the ThinLinc welcome screen.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mcn86iuoe2bd16zrmko6.png)

Click on the **OK** button. You should see the Ubuntu desktop on the following screen.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8pxl1bawywxp7zx2nd7.png)

## Access ThinLink Via GUI Client

ThinLinc provides a graphical client for macOS, Windows and Ubuntu. Using a GUI client you can get ThinLinc all features including sound-redirection and optimized performance for low-bandwidth connection. In this tutorial, we will download the ThinLinc GUI client package for Ubuntu and install it via the terminal.

First, download the ThinLinc client .deb package using the following command.

    wget https://www.cendio.com/downloads/clients/thinlinc-client_4.14.0-2324_amd64.deb

Next, install the downloaded package using the apt command.

    sudo apt install ./thinlinc-client_4.14.0-2324_amd64.deb

Once the ThinLinc client package is installed, launch it via the Ubuntu Dash menu as shown below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ww1yfo5c22noj9yhru1k.png)

Provide your ThinLinc server IP address, username, password, and click on the **Connect** button. After the successful authentication, you should see the Ubuntu desktop inside the ThinLinc client windows.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x94h52jd99umqekn1otq.png)
You can now play around with your Ubuntu remote desktop and test its performance, sound redirection, media redirection, and other features.

## Access ThinLinc Control Panel

ThinLinc also provides a web-based control panel to manage all user's sessions, profiles, and other settings. You can access it using the URL **https://your-server-ip:1010** via a web browser. You should see the ThinLinc login screen.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx410piev08q4j7alt5z.png)

Provide the default username as admin, your admin password which you have set during the installation then click on the **Sign in** button. After the successful login, you should see the ThinLinc control panel on the following screen.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1eu5w3p8yctx0uehtrx.png)

## Conclusion

In this guide, you learned how to install and configure the ThinLinc server on a Linux server running on a Google cloud. You also learned how to connect ThinLinc remote desktop via web browser and GUI client. I hope you can now easily implement the ThinLinc server on Linux.