{"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
In this guide, we are going to learn how to install Apache Guacamole on Ubuntu 20.04. Apache Guacamole<\/a> 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 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 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. 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 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 20.04;<\/p>\n\n\n\n Next, run the 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.<\/p>\n\n\n\n If UFW is running, allow Tomcat through it.<\/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 a source code or from ready binary. Binary installation is used in this demo. Download Guacamole-client from 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 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; 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 the configuration file and 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 Therefore, run the command below to create this file with the following contents.<\/p>\n\n\n\n Be sure to replace password<\/strong> with your strong password.<\/p>\n\n\n\n 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 If you need to explicitly define usernames and passwords, add the parameters;<\/p>\n\n\n\n Save and exit the configuration file.<\/p>\n\n\n\n You can check how to enable Guacamole OpenLDAP Authentication;<\/p>\n\n\n\nInstalling Guacamole on Ubuntu 20.04<\/h2>\n\n\n\n
\n
guacamole-server<\/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<\/code> which provides the client to be served by the servlet container which is usually
Tomcat<\/code>.<\/li>\n<\/ul>\n\n\n\n
Installing Guacamole Server on Ubuntu 20.04<\/h3>\n\n\n\n
Install Required Build Tools<\/h4>\n\n\n\n
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
Building Guacamole-Server on Ubuntu 20.04<\/h4>\n\n\n\n
wget https:\/\/downloads.apache.org\/guacamole\/1.4.0\/source\/guacamole-server-1.4.0.tar.gz<\/code><\/pre>\n\n\n\n
tar xzf guacamole-server-1.4.0.tar.gz<\/code><\/pre>\n\n\n\n
cd guacamole-server-1.4.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-systemd-dir=\/etc\/systemd\/system\/<\/code><\/pre>\n\n\n\n
.\/configure --help<\/code>.<\/p>\n\n\n\n
\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
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<\/h4>\n\n\n\n
systemctl enable --now guacd<\/code><\/pre>\n\n\n\n
systemctl status guacd<\/code><\/pre>\n\n\n\n
\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
Install Tomcat Servlet<\/h3>\n\n\n\n
apt install tomcat9 tomcat9-admin tomcat9-common tomcat9-user -y<\/code><\/pre>\n\n\n\n
ufw allow 8080\/tcp<\/code><\/pre>\n\n\n\n
Installing Guacamole Client on Ubuntu 20.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.4.0\/binary\/guacamole-1.4.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 20.04<\/h2>\n\n\n\n
\/etc\/guacamole<\/code> which is referenced by the
GUACAMOLE_HOME<\/code> environment variable and
\/etc\/guacamole\/guacamole.properties<\/code> which is the main configuration file used by Guacamole and its extensions.<\/p>\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\n<\/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>. 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
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 -->\n <connection name=\"CentOS-Server\">\n <protocol>ssh<\/protocol>\n <param name=\"hostname\">192.168.56.156<\/param>\n <param name=\"port\">22<\/param>\n <\/connection><\/strong>\n\n <!-- Second authorized remote connection -->\n <connection name=\"Windows 7\">\n <protocol>rdp<\/protocol>\n <param name=\"hostname\">192.168.56.122<\/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>\n<\/code><\/pre>\n\n\n\n
echo -n password | openssl md5<\/code><\/pre>\n\n\n\n
printf '%s' password | md5sum<\/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