Home / How To / How to install the web-based Guacamole Remote Desktop Client on Ubuntu 20.04 LTS

How to install the web-based Guacamole Remote Desktop Client on Ubuntu 20.04 LTS



Guacamole is a free, open source and web-based remote control panel used to manage Linux and Windows systems from the browser. It supports standard protocols such as VNC, RDP, SSH and Kubernetes, and you do not need to install any software on the client computer. It supports Clipboard, SFTP file transfer and allows you to manage multiple remote desktop sessions.

In this guide, we will show you how to install and configure the Guacamole Remote Desktop client on the Ubuntu 20.04 server.

Conditions

  • A server running Ubuntu 20.04 with at least 2 GB of RAM.
  • A root password is configured on the server.

Getting Started

First you need to update your system to the latest stable release. You can do this by updating all system packages with the following command:

apt-get update -y

Once your system has been updated, restart the system to apply the changes.

Install necessary dependencies

First, you need to install some dependencies on your server to compile Guacamole from the source. You can install them all with the following command:

apt-get install make gcc g++ libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev libssl-dev libvorbis-dev libwebp-dev -y

Once all the dependencies are installed, you can proceed to the next step.

Install Tomcat Server

Guacamole uses Tomcat to serve guacamole client content to users who connect to the guacamole server through the web browser. So the Tomcat server must be installed on your server. If it is not installed, you can install it with the following command:

apt-get install tomcat9 tomcat9-admin tomcat9-common tomcat9-user -y

After installing the Tomcat server, start the Tomcat service and allow it to restart at system startup with the following command:

systemctl start tomcat9
systemctl enable tomcat9

You can also verify the status of your Tomcat service with the following command:

systemctl status tomcat9

You should get the following output:

? tomcat9.service - Apache Tomcat 9 Web Application Server
     Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-08-25 14:48:50 UTC; 29min ago
       Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html
    Process: 27982 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (code=exited, status=0/SUCCESS)
   Main PID: 27990 (java)
      Tasks: 38 (limit: 4691)
     Memory: 241.5M
     CGroup: /system.slice/tomcat9.service
             ??27990 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties -Djava.util.l>

When you are done, you can move on to the next step.

Install Guacamole

By default, the Guacamole package is not available in the standard Ubuntu 20.04 repository. So you have to compile it from the source.

First, download the latest version of Guacamole from the Apache Web site with the following command:

wget https://downloads.apache.org/guacamole/1.1.0/source/guacamole-server-1.1.0.tar.gz

When the download is complete, extract the downloaded file with the following command:

tar -xvzf guacamole-server-1.1.0.tar.gz

Then change the directory to the extracted directory and run the configuration script to check if any dependencies are missing or not:

cd guacamole-server-1.1.0
./configure --with-init-dir=/etc/init.d

If all goes well, you should see the following output:

     freerdp2 ............ yes
     pango ............... yes
     libavcodec .......... yes
     libavutil ........... yes
     libssh2 ............. yes
     libssl .............. yes
     libswscale .......... yes
     libtelnet ........... yes
     libVNCServer ........ yes
     libvorbis ........... yes
     libpulse ............ no
     libwebsockets ....... no
     libwebp ............. yes
     wsock32 ............. no

   Protocol support:

      Kubernetes .... no
      RDP ........... yes
      SSH ........... yes
      Telnet ........ yes
      VNC ........... yes

   Services / tools:

      guacd ...... yes
      guacenc .... yes
      guaclog .... yes

   FreeRDP plugins: /usr/lib/x86_64-linux-gnu/freerdp2
   Init scripts: /etc/init.d
   Systemd units: no

Type "make" to compile guacamole-server.

Now compile and install Guacamole Server by running the following command:

make
make install

Then run the following command to update the system cache for installed libraries:

ldconfig

Then activate and start the Guacamole service with the following command

systemctl enable guacd
systemctl start guacd

You can now check the status of the Guacamole service with the following command:

systemctl status guacd

You should get the following output:

? guacd.service - LSB: Guacamole proxy daemon
     Loaded: loaded (/etc/init.d/guacd; generated)
     Active: active (running) since Tue 2020-08-25 12:02:26 UTC; 4s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 27536 ExecStart=/etc/init.d/guacd start (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 4691)
     Memory: 10.1M
     CGroup: /system.slice/guacd.service
             ??27555 /usr/local/sbin/guacd -p /var/run/guacd.pid

Aug 25 12:02:26 ubuntu2004 systemd[1]: Starting LSB: Guacamole proxy daemon...
Aug 25 12:02:26 ubuntu2004 guacd[27551]: Guacamole proxy daemon (guacd) version 1.1.0 started
Aug 25 12:02:26 ubuntu2004 guacd[27536]: Starting guacd:
Aug 25 12:02:26 ubuntu2004 guacd[27551]: Starting guacd:
Aug 25 12:02:26 ubuntu2004 guacd[27551]: uacd[27551]: INFO:        Guacamole proxy daemon (guacd) versio
Aug 25 12:02:26 ubuntu2004 systemd[1]: Started LSB: Guacamole proxy daemon.
Aug 25 12:02:26 ubuntu2004 guacd[27555]: Listening on host 127.0.0.1, port 4822
Aug 25 12:02:26 ubuntu2004 guacd[27536]: uacd[275

When you are done, you can move on to the next step.

Install Guacamole Client

Next, you need to install the Guacamole client on your server. The Guacamole client is written in Java and is cross-platform. This is the final HTML5 program that will be presented to you.

First download the Guacamole binary with the following command:

wget https://mirrors.estointernet.in/apache/guacamole/1.1.0/binary/guacamole-1.1.0.war

After downloading the Guacamole binary, copy it to the / etc / guacamole directory using the following command:Advertisement

Advertisement

mkdir /etc/guacamole
mv guacamole-1.1.0.war /etc/guacamole/guacamole.war

Then create a symbolic link of the guacamole client to the Tomcat webapp directory using the following command:

ln -s /etc/guacamole/guacamole.war /var/lib/tomcat9/webapps/

Finally, restart Tomcat and the Guacamole service to deploy the new web application:

systemctl restart tomcat9
systemctl restart guacd

When you are done, you can move on to the next step.

Configure Guacomole

Next, you need to configure users and connections to make Guacamole work properly.

First, create a main configuration file for Guacamole named guacamole.properties.

nano /etc/guacamole/guacamole.properties

Add the following lines:

guacd-hostname: localhost
guacd-port:    4822
user-mapping:    /etc/guacamole/user-mapping.xml

Save and close the file when you are done.

Next, you need to create directories for libraries and extensions. You can create them with the following command:

mkdir /etc/guacamole/{extensions,lib}

Then set the environment variable for the guacamole home directory and add it to the / etc / default / tomcat9 configuration file.

echo "GUACAMOLE_HOME=/etc/guacamole" >> /etc/default/tomcat9

Next, you need to create a file called user-mapping.xml to define the user who can access the Guacamole web interface.Advertisement

Before creating it, generate the md5 hash for the password using the following command:

echo -n yoursecurepassword | openssl md5

You should see the following output:

(stdin)= 55b38b03e7587a45fd886977842ff9b8

Note : Remember the above MD5 password. You must define this in the user-mapping.xml file.

Then create a new user-mapping.xml with the following command:

nano /etc/guacamole/user-mapping.xml

    

        
            ssh
            192.168.10.50
            22
            root
        
        
            rdp
            192.168.10.51
            3389
        
    

Save and close the file when you are done.

Where:

  • 192.168.10.50 is the IP address of the remote Ubuntu server.
  • 192.168.10.51 is the IP address of the deleted Windows server.

Then restart Tomcat and the Guacamole service to apply the changes:

systemctl restart tomcat9
systemctl restart guacd

At this time, the Guacamole server and client have been installed and configured.

Go to the Guacamole web interface

Now open your browser and access the Guacamole web interface with URL http: // your server-ip: 8080 / guacamole. You will be redirected to the Guacamole login page:

Guacamole Login

Enter the username and password you defined in user-mapping.xml and click Sign in button. You should see the Guacamole Dashboard on the following page:

Guacamole instrument panel

Now click on Ubuntu20.04 server to connect the remote server using the SSH protocol. You should see the Ubuntu server login screen as follows:

Guacamole remote login

Enter the root password of your Ubuntu server and hit Get on. You will log in to the Ubuntu server as follows:

Shell login via guacamole

Configure Nginx for Guacamole

It is recommended to configure Nginx as a reverse proxy to access Guacamole via port 80.

First, install the Nginx Web Server using the following command:

apt-get install nginx -y

After installing Nginx, create a new configuration file for Nginx virtual host:

nano /etc/nginx/sites-available/guacamole.conf

Add the following lines:

server {
        listen 80;
        server_name your-server-ip;
        access_log  /var/log/nginx/guac_access.log;
        error_log  /var/log/nginx/guac_error.log;

        location / {
                    proxy_pass http://your-server-ip:8080/guacamole/;
                    proxy_buffering off;
                    proxy_http_version 1.1;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection $http_connection;
                    proxy_cookie_path /guacamole/ /;
        }

}

Save and close the file when you are done. Then enable the Nginx virtual host with the following command:

ln -s /etc/nginx/sites-available/guacamole.conf /etc/nginx/sites-enabled/

Then restart the Nginx service to apply the configuration changes:Advertisement

systemctl restart nginx

Now you can access your Guacamole with URL http: // din-server-ip.

Conclusion

Congratulations! you have installed and configured the Guacamole Remote Desktop Client on an Ubuntu 20.04 server. You can now add more RDP or VNC connections to your Guacamole and start managing them from the web-based interface.


Source link