{"id":8451,"date":"2021-03-27T10:37:55","date_gmt":"2021-03-27T07:37:55","guid":{"rendered":"https:\/\/kifarunix.com\/?p=8451"},"modified":"2024-03-19T18:22:24","modified_gmt":"2024-03-19T15:22:24","slug":"install-apache-guacamole-on-ubuntu-21-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-apache-guacamole-on-ubuntu-21-04\/","title":{"rendered":"Install Apache Guacamole on Ubuntu 21.04"},"content":{"rendered":"\n
In this guide, we are going to learn how to install Apache Guacamole<\/a> on Ubuntu 21.04. Apache Guacamole is a clientless HTML5 web based remote desktop gateway which provides remote access to servers and desktops through a web browser. It supports standard protocols like VNC, RDP, and SSH.<\/p>\n\n\n\n Guacamole is made up of two parts;<\/p>\n\n\n\n You need to install both of these components to setup Apache Guacamole web-based remote desktop client.<\/p>\n\n\n\n Ensure your system package cache is up-to-date;<\/p>\n\n\n\n To install guacamole-server, you need to build it from the source. This, therefore, requires that you need install the required build tools before you can start to build guacamole-server component;<\/p>\n\n\n\n A comprehensive description of these dependency tools is available on required dependencies<\/a> section.<\/p>\n\n\n\n To build guacamole-server, download the latest source archive tarball from Guacamole releases page<\/a>. Apache Guacamole 1.3.0<\/a> is the latest release version as of this writing.<\/p>\n\n\n\n You can simply run the command below to download Apache Guacamole 1.3.0.<\/p>\n\n\n\n Once the download is done, extract the source tarball.<\/p>\n\n\n\n Navigate to guacamole server source code directory;<\/p>\n\n\n\n Run the For more configure options, run, Pay attention to out of the Compile and install Guacamole Server on Ubuntu 21.04;<\/p>\n\n\n\n Next, run the Reload systemd configuration files and start and enable guacd (Guacamole Daemon) to run on boot after the installation.<\/p>\n\n\n\n To check the status;<\/p>\n\n\n\n Apache Tomcat is used to serve guacamole client content to users that connects to guacamole server via the web browser. To install Tomcat, run the command below;<\/p>\n\n\n\n Tomcat9 is started and enabled to run on system boot upon installation. Check the status by running the command below;<\/p>\n\n\n\n Apache Tomcat listens on port 8080\/tcp by default;<\/p>\n\n\n\n To allow external access to the serverlet, open the serverlet port 8080\/tcp on UFW.<\/p>\n\n\n\n guacamole-client contains provides web application that will serve the HTML5 Guacamole client to users that connect to your server. The web application will then connect to guacd on behalf of connected users in order to serve them any remote desktop they are authorized to access.<\/p>\n\n\n\n Create Guacamole configuration directory;<\/p>\n\n\n\n Guacamole client can be installed from source code or from ready binary. Binary installation is used in this demo.<\/p>\n\n\n\n Download Guacamole-client from Guacamole releases page<\/a> for the respective latest version (v1.3.0 as of this writing) and store it in the configuration directory created above.<\/p>\n\n\n\n To download the current release version, v1.3.0 as of this writing, simply run the command below;<\/p>\n\n\n\n Create a symbolic link of the guacamole client to Tomcat webapps directory as shown below;<\/p>\n\n\n\n Restart Tomcat to deploy the new web application;<\/p>\n\n\n\n Restart guacd daemon as well;<\/p>\n\n\n\n Guacamole has two major configuration files;<\/p>\n\n\n\n There are also guacamole extensions and libraries configurations. You need to create the directories for these configs;<\/p>\n\n\n\n Set the guacamole home directory environment variable and add it to To define how Guacamole connects to After that, save and exit the configuration file.<\/p>\n\n\n\n Next, link the Guacamole configurations directory to Tomcat servlet directory as shown below.<\/p>\n\n\n\n Guacamole\u2019s default authentication method reads all users and connections from a single file called In this file,you need to define the users allowed to access Guacamole web UI<\/strong>, the servers to connect to<\/strong> and the method of connection<\/strong>.<\/p>\n\n\n\n Other authentication methods are supported, but beyond the scope of this tutorial.<\/p>\n\n\n\n To begin with, generate the MD5 hash of passwords for the user to be used for logging into Guacamole web user interface. Replace you password accordingly<\/strong>;<\/p>\n\n\n\n Output;<\/p>\n\n\n\n or<\/p>\n\n\n\n Output;<\/p>\n\n\n\n Be sure to replace password<\/strong> with your strong password.<\/p>\n\n\n\n Next, create the default user authentication file, If you dont specify the username and password in the file, you will be prompted to provide them while attempting to login, which i consider it abit secure.<\/p>\n\n\n\n If you need to explicitly define usernames and passwords in the configuration file, add the parameters;<\/p>\n\n\n\n Save and exit the configuration file.<\/p>\n\n\n\n Restart both Tomcat and guacd to effect the changes.<\/p>\n\n\n\n Be sure to check the syslog, Apache Guacamole server is now setup. You can access it from web browser using the address Use the credentials for the user whom you generated an MD5 hash for its password above.<\/p>\n\n\n\n Upon successful login, you get to Apache Guacamole web dashboard and you should be able to see the added connections.<\/p>\n\n\n\n Click on a connection to name to initiate remote login.<\/p>\n\n\n\n For example, to ssh into my Ubuntu server, just click on the connection name. This will get you a login prompt;<\/p>\n\n\n\n To login to Windows 7 via RDP, just click on Windows 7;<\/p>\n\n\n\n And there you go. Enter your password and proceed to your desktop.<\/p>\n\n\n\n You can now add more connections to your Guacamole.<\/p>\n\n\n\n Related guides;<\/p>\n\n\n\n Configure Guacamole SSL\/TLS with Nginx Reverse Proxy<\/a><\/p>\n\n\n\n How to Enable RDP\/SSH File Transfer Over Guacamole<\/a><\/p>\n\n\n\n Guacamole User Manual<\/a><\/p>\n\n\n\n Install NoMachine Remote Desktop Tool on Kali Linux 2020<\/a><\/p>\n\n\n\n Install and Setup Chrome Remote Desktop on Ubuntu 20.04<\/a><\/p>\n\n\n\nInstall Guacamole on Ubuntu 21.04<\/h2>\n\n\n\n
\n
guacamole-server<\/a><\/code>, which provides the guacd proxy and all the native, server-side components required by Guacamole to connect to remote desktops.<\/li>\n\n\n\n
guacamole-client<\/a><\/code> which provides the client to be served by the servlet container which is usually
Tomcat<\/code>.<\/li>\n<\/ul>\n\n\n\n
Install Guacamole Server on Ubuntu 21.04<\/h3>\n\n\n\n
Run system Update<\/h4>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
Install Required Build Tools<\/h4>\n\n\n\n
apt install -y build-essential libcairo2-dev libjpeg-turbo8-dev libpng-dev \\\nlibtool-bin libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \\\nfreerdp2-dev libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev \\\nlibssl-dev libvorbis-dev libwebp-dev<\/code><\/pre>\n\n\n\n
Building Guacamole Server on Ubuntu 21.04<\/h4>\n\n\n\n
wget https:\/\/downloads.apache.org\/guacamole\/1.3.0\/source\/guacamole-server-1.3.0.tar.gz<\/code><\/pre>\n\n\n\n
tar xzf guacamole-server-1.3.0.tar.gz<\/code><\/pre>\n\n\n\n
cd guacamole-server-1.3.0<\/code><\/pre>\n\n\n\n
configure<\/code> script to check if any required dependency is missing and to adapt Guacamole server to your system.<\/p>\n\n\n\n
.\/configure --with-init-dir=\/etc\/init.d<\/strong><\/code><\/pre>\n\n\n\n
.\/configure --help<\/code>.<\/p>\n\n\n\n
...\n------------------------------------------------\nguacamole-server version 1.3.0\n------------------------------------------------\n\n Library status:\n\n freerdp2 ............ yes\n pango ............... yes\n libavcodec .......... yes\n libavformat.......... yes\n libavutil ........... yes\n libssh2 ............. yes\n libssl .............. yes\n libswscale .......... yes\n libtelnet ........... yes\n libVNCServer ........ yes\n libvorbis ........... yes\n libpulse ............ no\n libwebsockets ....... no\n libwebp ............. yes\n wsock32 ............. no\n\n Protocol support:\n\n Kubernetes .... no\n RDP ........... yes\n SSH ........... yes\n Telnet ........ yes\n VNC ........... yes\n\n Services \/ tools:\n\n guacd ...... yes\n guacenc .... yes\n guaclog .... yes\n\n FreeRDP plugins: \/usr\/lib\/x86_64-linux-gnu\/freerdp2\n Init scripts: \/etc\/init.d\n Systemd units: no\n\nType \"make\" to compile guacamole-server.<\/code><\/pre>\n\n\n\n
configure<\/code> script.<\/p>\n\n\n\n
make<\/code><\/pre>\n\n\n\n
make install<\/code><\/pre>\n\n\n\n
ldconfig<\/code><\/strong> command to create the necessary links and cache to the most recent shared libraries found in the guacamole server directory.<\/p>\n\n\n\n
ldconfig<\/code><\/pre>\n\n\n\n
Running Guacamole-Server on Ubuntu 21.04<\/h4>\n\n\n\n
systemctl daemon-reload<\/code><\/pre>\n\n\n\n
systemctl start guacd<\/code><\/pre>\n\n\n\n
systemctl enable guacd<\/code><\/pre>\n\n\n\n
systemctl status guacd<\/code><\/pre>\n\n\n\n
\u25cf guacd.service - LSB: Guacamole proxy daemon\n Loaded: loaded (\/etc\/init.d\/guacd; generated)\n Active: active (running) since Sat 2021-03-27 05:12:24 UTC; 1s ago\n Docs: man:systemd-sysv-generator(8)\n Process: 22887 ExecStart=\/etc\/init.d\/guacd start (code=exited, status=0\/SUCCESS)\n Tasks: 1 (limit: 1042)\n Memory: 9.9M\n CGroup: \/system.slice\/guacd.service\n \u2514\u250022891 \/usr\/local\/sbin\/guacd -p \/var\/run\/guacd.pid\n\nMar 27 05:12:24 hirsute systemd[1]: Starting LSB: Guacamole proxy daemon...\nMar 27 05:12:24 hirsute guacd[22888]: Guacamole proxy daemon (guacd) version 1.3.0 started\nMar 27 05:12:24 hirsute guacd[22887]: Starting guacd:\nMar 27 05:12:24 hirsute guacd[22888]: guacd[22888]: INFO: Guacamole proxy daemon (guacd) version 1.3.0 started\nMar 27 05:12:24 hirsute guacd[22887]: SUCCESS\nMar 27 05:12:24 hirsute guacd[22891]: Listening on host 127.0.0.1, port 4822\nMar 27 05:12:24 hirsute systemd[1]: Started LSB: Guacamole proxy daemon.<\/code><\/pre>\n\n\n\n
Install Tomcat Servlet<\/h3>\n\n\n\n
apt install tomcat9 tomcat9-admin tomcat9-common tomcat9-user -y<\/code><\/pre>\n\n\n\n
systemctl status tomcat9.service<\/code><\/pre>\n\n\n\n
\u25cf tomcat9.service - Apache Tomcat 9 Web Application Server\n Loaded: loaded (\/lib\/systemd\/system\/tomcat9.service; enabled; vendor preset: enabled)\n Active: active (running) since Sat 2021-03-27 05:17:40 UTC; 2min 40s ago\n Docs: https:\/\/tomcat.apache.org\/tomcat-9.0-doc\/index.html\n Process: 24611 ExecStartPre=\/usr\/libexec\/tomcat9\/tomcat-update-policy.sh (code=exited, status=0\/SUCCESS)\n Main PID: 24615 (java)\n Tasks: 29 (limit: 1042)\n Memory: 72.8M\n CGroup: \/system.slice\/tomcat9.service\n \u2514\u250024615 \/usr\/lib\/jvm\/default-java\/bin\/java -Djava.util.logging.config.file=\/var\/lib\/tomcat9\/conf\/logging.properties -Djava.util.logging.manager=org.apache.jul>\n\nMar 27 05:17:45 hirsute tomcat9[24615]: Deployment of deployment descriptor [\/etc\/tomcat9\/Catalina\/localhost\/host-manager.xml] has finished in [1,800] ms\nMar 27 05:17:45 hirsute tomcat9[24615]: Deploying deployment descriptor [\/etc\/tomcat9\/Catalina\/localhost\/manager.xml]<\/code><\/pre>\n\n\n\n
ss -altnp | grep 80<\/code><\/pre>\n\n\n\n
LISTEN 0 100 *:8080 *:* users:((\"java\",pid=24615,fd=37))<\/code><\/pre>\n\n\n\n
ufw allow 8080\/tcp<\/code><\/pre>\n\n\n\n
Installing Guacamole Client on Ubuntu 21.04<\/h3>\n\n\n\n
mkdir \/etc\/guacamole<\/code><\/pre>\n\n\n\n
Download Guacamole-client Binary<\/h4>\n\n\n\n
wget https:\/\/downloads.apache.org\/guacamole\/1.3.0\/binary\/guacamole-1.3.0.war -O \/etc\/guacamole\/guacamole.war<\/code><\/pre>\n\n\n\n
ln -s \/etc\/guacamole\/guacamole.war \/var\/lib\/tomcat9\/webapps\/<\/code><\/pre>\n\n\n\n
systemctl restart tomcat9<\/code><\/pre>\n\n\n\n
systemctl restart guacd<\/code><\/pre>\n\n\n\n
Configure Apache Guacamole on Ubuntu 21.04<\/h2>\n\n\n\n
\n
\/etc\/guacamole<\/strong><\/code> which is referenced by the
GUACAMOLE_HOME<\/code> environment variable<\/li>\n\n\n\n
\/etc\/guacamole\/guacamole.properties<\/strong><\/code> which is the main configuration file used by Guacamole and its extensions.<\/li>\n<\/ul>\n\n\n\n
mkdir \/etc\/guacamole\/{extensions,lib}<\/code><\/pre>\n\n\n\n
\/etc\/default\/tomcat9<\/strong><\/code> configuration file.<\/p>\n\n\n\n
echo \"GUACAMOLE_HOME=\/etc\/guacamole\" >> \/etc\/default\/tomcat9<\/code><\/pre>\n\n\n\n
Configure Guacamole Server Connections<\/h4>\n\n\n\n
guacd<\/code>, create the
guacamole.properties<\/code> file under
\/etc\/guacamole<\/strong><\/code> directory with the following content.<\/p>\n\n\n\n
vim \/etc\/guacamole\/guacamole.properties<\/code><\/pre>\n\n\n\n
guacd-hostname: localhost\nguacd-port: 4822\nuser-mapping: \/etc\/guacamole\/user-mapping.xml\nauth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider<\/code><\/pre>\n\n\n\n
ln -s \/etc\/guacamole \/usr\/share\/tomcat9\/.guacamole<\/code><\/pre>\n\n\n\n
Configure Guacamole Authentication Method<\/h4>\n\n\n\n
user-mapping.xml<\/code>.<\/p>\n\n\n\n
echo -n password | openssl md5<\/code><\/pre>\n\n\n\n
(stdin)= 5f4dcc3b5aa765d61d8327deb882cf99<\/code><\/pre>\n\n\n\n
printf '%s' password | md5sum<\/code><\/pre>\n\n\n\n
5f4dcc3b5aa765d61d8327deb882cf99 -<\/code><\/pre>\n\n\n\n
user-mapping.xml<\/strong><\/code> with the following contents.<\/p>\n\n\n\n
vim \/etc\/guacamole\/user-mapping.xml<\/code><\/pre>\n\n\n\n
<user-mapping>\n \n <!-- Per-user authentication and config information -->\n\n <!-- A user using md5 to hash the password\n guacadmin user and its md5 hashed password below is used to <\/strong>\n login to Guacamole Web UI<\/strong>-->\n <authorize \n username=\"guacadmin<\/strong>\"\n password=\"5f4dcc3b5aa765d61d8327deb882cf99\"\n encoding=\"md5\">\n\n <!-- First authorized Remote connection<\/strong> -->\n <connection name=\"Ubuntu 20.04 Server SSH\">\n <protocol>ssh<\/protocol>\n <param name=\"hostname\">192.168.57.3<\/param>\n <param name=\"port\">22<\/param>\n <\/connection><\/strong>\n\n <!-- Second authorized remote connection -->\n <connection name=\"Windows 7 RDP\">\n <protocol>rdp<\/protocol>\n <param name=\"hostname\">192.168.56.103<\/param>\n <param name=\"port\">3389<\/param><\/strong>\n <param name=\"username\">koromicha<\/param>\n <param name=\"ignore-cert\">true<\/param>\n <\/connection><\/strong>\n\n <\/authorize>\n\n<\/user-mapping><\/code><\/pre>\n\n\n\n
<param name=\"username\">USERNAME<\/strong><\/param>\n<param name=\"password\">PASSWORD<\/param><\/strong><\/code><\/pre>\n\n\n\n
systemctl restart tomcat9 guacd<\/code><\/pre>\n\n\n\n
\/var\/log\/syslog<\/code> or
\/var\/log\/tomcat9\/CATALINA-*<\/code> for any issues.<\/p>\n\n\n\n
Accessing Apache Guacamole from Browse<\/h3>\n\n\n\n
http:\/\/server-IP:8080\/guacamole<\/strong><\/code>.<\/p>\n\n\n
<\/figure><\/div>\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Further Reading<\/h3>\n\n\n\n
Other tutorials<\/h3>\n\n\n\n