{"id":5556,"date":"2020-04-20T23:58:59","date_gmt":"2020-04-20T20:58:59","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5556"},"modified":"2024-03-14T20:13:21","modified_gmt":"2024-03-14T17:13:21","slug":"install-apache-guacamole-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-apache-guacamole-on-ubuntu-20-04\/","title":{"rendered":"Install Apache Guacamole on Ubuntu 20.04"},"content":{"rendered":"\n<p>In this guide, we are going to learn how to install Apache Guacamole on Ubuntu 20.04. <a href=\"https:\/\/guacamole.apache.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Apache Guacamole<\/a>&nbsp;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<h2 class=\"wp-block-heading\">Installing Guacamole on Ubuntu 20.04<\/h2>\n\n\n\n<p>Guacamole is made up of two parts;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>guacamole-server<\/code>, which provides the&nbsp;guacd&nbsp;proxy&nbsp;and all the native, server-side components required by Guacamole to connect to remote desktops.<\/li>\n\n\n\n<li><code>guacamole-client<\/code>&nbsp;which provides the client to be served by the servlet container which is usually&nbsp;<code>Tomcat<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>You need to install both of these components to setup Apache Guacamole web-based remote desktop client.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Guacamole Server on Ubuntu 20.04<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Install Required Build Tools<\/h4>\n\n\n\n<p>To install Guacamole, 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<pre class=\"wp-block-code\"><code>apt install -y gcc g++ libcairo2-dev libjpeg-turbo8-dev \\\nlibpng-dev libtool-bin libossp-uuid-dev libavcodec-dev \\\nlibavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev \\\nlibssh2-1-dev build-essential libvncserver-dev libtelnet-dev \\\nlibssl-dev libvorbis-dev libwebp-dev libwebsockets-dev libpulse-dev libavformat-dev<\/code><\/pre>\n\n\n\n<p>A comprehensive description of these dependency tools is available on <a rel=\"noreferrer noopener\" href=\"https:\/\/guacamole.apache.org\/doc\/gug\/installing-guacamole.html#required-dependencies\" target=\"_blank\">required dependencies<\/a> section.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Building&nbsp;Guacamole-Server on Ubuntu 20.04<\/h4>\n\n\n\n<p>To build guacamole-server, download the latest source archive tarball from Guacamole releases page. Guacamole 1.4.0 is the latest release version as of this writing. You can simply run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/downloads.apache.org\/guacamole\/1.4.0\/source\/guacamole-server-1.4.0.tar.gz<\/code><\/pre>\n\n\n\n<p>Once the download is done, extract the source tarball.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar xzf guacamole-server-1.4.0.tar.gz<\/code><\/pre>\n\n\n\n<p>Navigate to guacamole server source code directory;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd guacamole-server-1.4.0<\/code><\/pre>\n\n\n\n<p>Run the&nbsp;<code>configure<\/code>&nbsp;script to check if any required dependency is missing and to adapt Guacamole server to your system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --with-systemd-dir=\/etc\/systemd\/system\/<\/code><\/pre>\n\n\n\n<p>For more configure options, run, <code>.\/configure --help<\/code>.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n------------------------------------------------\nguacamole-server version 1.4.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 ............ yes\n     libwebsockets ....... yes\n     libwebp ............. yes\n     wsock32 ............. no\n\n   Protocol support:\n\n      Kubernetes .... yes\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: no\n   Systemd units: \/etc\/systemd\/system\/\n\nType \"make\" to compile guacamole-server.\n<\/code><\/pre>\n\n\n\n<p>Pay attention to out of the <code>configure<\/code> script.<\/p>\n\n\n\n<p>Compile and install Guacamole Server on Ubuntu 20.04;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install<\/code><\/pre>\n\n\n\n<p>Next, run the&nbsp;<strong><code>ldconfig<\/code><\/strong>&nbsp;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<pre class=\"wp-block-preformatted\"><code>ldconfig<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Running Guacamole-Server<\/h4>\n\n\n\n<p>Start and enable guacd (Guacamole Daemon) to run on boot after  the installation.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable --now guacd<\/code><\/pre>\n\n\n\n<p>To check the status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status guacd<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n\u25cf guacd.service - Guacamole Server\n     Loaded: loaded (\/etc\/systemd\/system\/guacd.service; enabled; vendor preset: enabled)\n     Active: active (running) since Sat 2022-04-09 07:51:36 EAT; 2s ago\n       Docs: man:guacd(8)\n   Main PID: 21478 (guacd)\n      Tasks: 1 (limit: 2318)\n     Memory: 9.8M\n     CGroup: \/system.slice\/guacd.service\n             \u2514\u250021478 \/usr\/local\/sbin\/guacd -f\n\nElb 09 07:51:36 koromicha systemd[1]: Started Guacamole Server.\nElb 09 07:51:36 koromicha guacd[21478]: Guacamole proxy daemon (guacd) version 1.4.0 started\nElb 09 07:51:36 koromicha guacd[21478]: guacd[21478]: INFO:        Guacamole proxy daemon (guacd) version 1.4.0 started\nElb 09 07:51:36 koromicha guacd[21478]: Listening on host 127.0.0.1, port 4822\nElb 09 07:51:36 koromicha guacd[21478]: guacd[21478]: INFO:        Listening on host 127.0.0.1, port 4822\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Tomcat Servlet<\/h3>\n\n\n\n<p>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<pre class=\"wp-block-preformatted\"><code>apt install tomcat9 tomcat9-admin tomcat9-common tomcat9-user -y<\/code><\/pre>\n\n\n\n<p>Tomcat9 is started and enabled to run on system boot upon installation.<\/p>\n\n\n\n<p>If UFW is running, allow Tomcat&nbsp; through it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ufw allow 8080\/tcp<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Guacamole Client on Ubuntu 20.04<\/h3>\n\n\n\n<p>guacamole-client&nbsp;contains provides web application that will serve the HTML5 Guacamole client to users that connect to your server.&nbsp;The web application will then connect to&nbsp;guacd&nbsp;on behalf of connected users in order to serve them any remote desktop they are authorized to access.<\/p>\n\n\n\n<p>Create Guacamole configuration directory;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/etc\/guacamole<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Download Guacamole-client Binary<\/h4>\n\n\n\n<p>Guacamole client can be installed from a source code or from ready binary. Binary installation is used in this demo. Download Guacamole-client from <a href=\"https:\/\/guacamole.apache.org\/releases\/\" target=\"_blank\" rel=\"noreferrer noopener\">Guacamole releases page<\/a> for the respective latest version (v1.4.0 as of this writing) and store it in the configuration directory created above;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wget https:\/\/downloads.apache.org\/guacamole\/1.4.0\/binary\/guacamole-1.4.0.war -O \/etc\/guacamole\/guacamole.war<\/code><\/pre>\n\n\n\n<p>Create a symbolic link of the guacamole client to Tomcat webapps directory as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ln -s \/etc\/guacamole\/guacamole.war \/var\/lib\/tomcat9\/webapps\/<\/code><\/pre>\n\n\n\n<p>Restart Tomcat to deploy the new web application;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart tomcat9<\/code><\/pre>\n\n\n\n<p>Restart guacd&nbsp;daemon as well;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart guacd<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Configure Apache Guacamole on Ubuntu 20.04<\/h2>\n\n\n\n<p>Guacamole has two major configuration files;&nbsp;<code>\/etc\/guacamole<\/code>&nbsp;which is referenced by the&nbsp;<code>GUACAMOLE_HOME<\/code>&nbsp;environment variable and&nbsp;<code>\/etc\/guacamole\/guacamole.properties<\/code>&nbsp;which is the main configuration file used by Guacamole and its extensions.<\/p>\n\n\n\n<p>There are also guacamole extensions and libraries configurations. You need to create the directories for these configs;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mkdir \/etc\/guacamole\/{extensions,lib}<\/code><\/pre>\n\n\n\n<p>Set the guacamole home directory environment variable and add it to <code><strong>\/etc\/default\/tomcat9<\/strong><\/code> configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo \"GUACAMOLE_HOME=\/etc\/guacamole\" &gt;&gt; \/etc\/default\/tomcat9<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Guacamole Server Connections<\/h4>\n\n\n\n<p>To define how Guacamole connects to&nbsp;<code>guacd<\/code>, create the&nbsp;<code>guacamole.properties<\/code>&nbsp;file under <code><strong>\/etc\/guacamole<\/strong><\/code> directory with the following content.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/guacamole\/guacamole.properties<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>guacd-hostname: localhost\nguacd-port:     4822\nuser-mapping:   \/etc\/guacamole\/user-mapping.xml\nauth-provider:  net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider\n<\/code><\/pre>\n\n\n\n<p>After that, save the configuration file and link the Guacamole configurations directory to Tomcat servlet directory as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ln -s \/etc\/guacamole \/usr\/share\/tomcat9\/.guacamole<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Guacamole Authentication Method<\/h4>\n\n\n\n<p>Guacamole\u2019s default authentication method reads all users and connections from a single file called&nbsp;<code>user-mapping.xml<\/code>. In this file,you need to define the <strong>users allowed to access Guacamole web UI<\/strong>,<strong> the servers to connect to<\/strong> and <strong>the method of connection<\/strong>.<\/p>\n\n\n\n<p>Therefore, run the command below to create this file with the following contents.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/guacamole\/user-mapping.xml<\/code><\/pre>\n\n\n\n<p>Be sure to replace&nbsp;<strong>password<\/strong>&nbsp;with your strong password.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>&lt;user-mapping&gt;\n        \n    &lt;!-- Per-user authentication and config information --&gt;\n\n    &lt;!-- A user using md5 to hash the password\n         <strong>guacadmin user and its md5 hashed password below is used to <\/strong>\n<strong>             login to Guacamole Web UI<\/strong>--&gt;\n    &lt;authorize \n            username=\"<strong>guacadmin<\/strong>\"\n            password=\"5f4dcc3b5aa765d61d8327deb882cf99\"\n            encoding=\"md5\"&gt;\n\n        &lt;!-- First authorized Remote connection --&gt;\n<strong>        &lt;connection name=\"CentOS-Server\"&gt;\n            &lt;protocol&gt;ssh&lt;\/protocol&gt;\n            &lt;param name=\"hostname\"&gt;192.168.56.156&lt;\/param&gt;\n            &lt;param name=\"port\"&gt;22&lt;\/param&gt;\n        &lt;\/connection&gt;<\/strong>\n\n        &lt;!-- Second authorized remote connection --&gt;\n<strong>        &lt;connection name=\"Windows 7\"&gt;\n            &lt;protocol&gt;rdp&lt;\/protocol&gt;\n            &lt;param name=\"hostname\"&gt;192.168.56.122&lt;\/param&gt;\n            &lt;param name=\"port\"&gt;3389&lt;\/param&gt;<\/strong>\n            <strong>&lt;param name=\"username\"&gt;koromicha&lt;\/param&gt;\n            &lt;param name=\"ignore-cert\"&gt;true&lt;\/param&gt;\n        &lt;\/connection&gt;<\/strong>\n\n    &lt;\/authorize&gt;\n\n&lt;\/user-mapping&gt;\n<\/code><\/pre>\n\n\n\n<p>Generate the MD5 hash of passwords for the user used for logging into Guacamole web user interface. Replace you password accordingly;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo -n password | openssl md5<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>printf '%s' password | md5sum<\/code><\/pre>\n\n\n\n<p>If you need to explicitly define usernames and passwords, add the parameters;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;param name=\"username\"&gt;<strong>USERNAME<\/strong>&lt;\/param&gt;\n&lt;param name=\"password\"&gt;<strong>PASSWORD&lt;\/param&gt;<\/strong><\/code><\/pre>\n\n\n\n<p>Save and exit the configuration file.<\/p>\n\n\n\n<p>You can check how to enable Guacamole OpenLDAP Authentication;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/setup-apache-guacamole-openldap-authentication\/\" target=\"_blank\" rel=\"noreferrer noopener\">Setup Apache Guacamole OpenLDAP Authentication<\/a><\/p>\n\n\n\n<p>Restart both Tomcat and guacd to effect the changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart tomcat9 guacd<\/code><\/pre>\n\n\n\n<p>Be sure to check the syslog, <code>\/var\/log\/syslog<\/code> or <code>\/var\/log\/tomcat9\/CATALINA-*<\/code> for any issues.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Accessing Apache Guacamole from Browse<\/h3>\n\n\n\n<p>Once Guacamole is setup, you can access it from web browser using the address&nbsp;<code><strong>http:\/\/server-IP:8080\/guacamole<\/strong><\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"570\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/apache-guacamole.png\" alt=\"Install Apache Guacamole on Ubuntu 20.04\" class=\"wp-image-8471\" title=\"\"><\/figure>\n\n\n\n<p>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<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1363\" height=\"357\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/guacamole-web.png\" alt=\"\" class=\"wp-image-8472\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/guacamole-web.png?v=1616858477 1363w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/guacamole-web-768x201.png?v=1616858477 768w\" sizes=\"(max-width: 1363px) 100vw, 1363px\" \/><\/figure>\n\n\n\n<p>Click on a connection to name to initiate remote login. For example, SSHing into my CentOS-serve gets a me password prompt since we already defined the user;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1099\" height=\"460\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/guacamole-ssh.png\" alt=\"\" class=\"wp-image-8473\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/guacamole-ssh.png?v=1616858513 1099w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/guacamole-ssh-768x321.png?v=1616858513 768w\" sizes=\"(max-width: 1099px) 100vw, 1099px\" \/><\/figure>\n\n\n\n<p>To login to Windows 7 via RDP, just click on Windows 7;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1363\" height=\"697\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/windows7-guacamole.png\" alt=\"\" class=\"wp-image-8474\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/windows7-guacamole.png?v=1616858538 1363w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/03\/windows7-guacamole-768x393.png?v=1616858538 768w\" sizes=\"(max-width: 1363px) 100vw, 1363px\" \/><\/figure>\n\n\n\n<p>And there you go. Enter your password and proceed to your desktop.<\/p>\n\n\n\n<p>You can now add more connections to your Guacamole. That marks the end of our guide on install Apache Guacamole.<\/p>\n\n\n\n<p>Read more on Guacamole User Guide.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-setup-guacamole-web-based-remote-desktop-access-tool-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Setup Guacamole Web-based Remote Desktop Access Tool on Ubuntu 18.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we are going to learn how to install Apache Guacamole on Ubuntu 20.04. Apache Guacamole&nbsp;is a clientless HTML5 web based remote desktop<\/p>\n","protected":false},"author":1,"featured_media":8461,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[214,121],"tags":[1479,215,1478,1477,1475,336,1476,978],"class_list":["post-5556","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-remote-desktop","category-howtos","tag-apache-guacamole","tag-guacamole","tag-guacamole-rdp","tag-guacamole-ssh","tag-guacamole-ubuntu-20-04","tag-guacd","tag-install-guacamole-ubuntu-20-04","tag-remote-desktop","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5556"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=5556"}],"version-history":[{"count":14,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5556\/revisions"}],"predecessor-version":[{"id":21361,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5556\/revisions\/21361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/8461"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=5556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=5556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=5556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}