{"id":9768,"date":"2021-07-24T22:39:29","date_gmt":"2021-07-24T19:39:29","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9768"},"modified":"2024-03-18T19:33:23","modified_gmt":"2024-03-18T16:33:23","slug":"install-apache-guacamole-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-apache-guacamole-on-rocky-linux-8\/","title":{"rendered":"Install Apache Guacamole on Rocky Linux 8"},"content":{"rendered":"\n
In this guide, we are going to learn how to install Apache Guacamole<\/a> on Rocky Linux 8. 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 Some of the required packages are provided by EPEL\/PowerTools repositories. Install and enable them as follows;<\/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 Apache Tomcat is used to serve guacamole client content to users that connects to guacamole server via the web browser.<\/p>\n\n\n\n To install Tomcat, run the command below;<\/p>\n\n\n\n Create Tomcat user;<\/p>\n\n\n\n Create the home directory;<\/p>\n\n\n\n Download Tomcat binary distributions<\/a>. We use version 9.0.50 in this demo.<\/p>\n\n\n\n Extract the tarball to home directory created above;<\/p>\n\n\n\n Set ownership of the Tomcat home directory;<\/p>\n\n\n\n Create systemd service for Apache Tomcat by running the command below;<\/p>\n\n\n\n Start and enable Apache Tomcat service.<\/p>\n\n\n\n Check the status;<\/p>\n\n\n\n If you want to enable it to run on boot;<\/p>\n\n\n\n systemctl enable tomcat<\/p>\n\n\n\n To build guacamole-server, download the latest source archive tarball from Guacamole releases page<\/a>. Guacamole 1.3.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, Sample configuration output;<\/p>\n\n\n\n Pay attention to out of the Compile and install Guacamole Server on Rocky Linux 8;<\/p>\n\n\n\n Next, run the Start guacd (Guacamole Daemon) to run on boot after the installation.<\/p>\n\n\n\n Check the status;<\/p>\n\n\n\n If you want to enable guacd (Guacamole Daemon) to run on boot after the installation.<\/p>\n\n\n\n guacamole-client 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.3.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, 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 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 Be sure to replace password<\/strong> with your strong password.<\/p>\n\n\n\n Next, run the command below to create this file, If you need to explicitly define usernames and passwords, add the parameters;<\/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, Once Guacamole is setup, you can access it from web browser using the address Allow external access to Apache Guacamole via Apache Tomcat on firewalld;<\/p>\n\n\n\n <\/a><\/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, SSHing into my ubuntu-server vm gets a me password prompt since we already defined the user in the configuration file;<\/a><\/p>\n\n\n\n To login to Windows 7 via RDP, just click on Windows 7. Ensure that you have allowed the user to login via RDP.<\/p>\n\n\n\n Windows RDP Authenthication may fail with errors shown below on As much as you need to check the RDP Authentication and Security settings<\/a> on what security mode to configure, this is how I fixed the above error.<\/p>\n\n\n\n Firs thing to note is Guacamole server (guacd) service runs as user In this case, the easiest way to enable RDP is to actually create a guacd system with its own home directory which it will have full access to write to.<\/p>\n\n\n\n Next, update the Guacd service user;<\/p>\n\n\n\n Reload systemd daemon;<\/p>\n\n\n\n Restart Guacd Service;<\/p>\n\n\n\n Windows RDP should now be working.<\/p>\n\n\n\n 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 Read more on Guacamole User Guide<\/a>.<\/p>\n\n\n\n Setup Apache Guacamole OpenLDAP Authentication<\/a><\/p>\n\n\n\n Install Apache Guacamole on Debian 10<\/a><\/p>\n\n\n\n Configure Guacamole SSL\/TLS with Nginx Reverse Proxy<\/a><\/p>\n\n\n\nInstalling Apache Guacamole on Rocky Linux 8<\/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 Rocky Linux 8<\/h3>\n\n\n\n
Install Additional Repositories<\/h4>\n\n\n\n
dnf install epel-release -y<\/code><\/pre>\n\n\n\n
dnf config-manager --set-enabled powertools<\/code><\/pre>\n\n\n\n
Install Required Build Tools<\/h4>\n\n\n\n
dnf install -y unzip curl make cmake wget gcc zlib-devel compat-openssl10 cairo-devel libjpeg-turbo-devel \\\nlibpng-devel libtool uuid-devel freerdp-devel pango-devel libssh2-devel libtelnet-devel libvncserver-devel \\\nlibwebsockets-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel wget vim<\/code><\/pre>\n\n\n\n
Install Tomcat Servlet<\/h3>\n\n\n\n
dnf install java-11-openjdk-devel<\/code><\/pre>\n\n\n\n
useradd -d \/usr\/share\/tomcat -M -r -s \/bin\/false tomcat<\/code><\/pre>\n\n\n\n
mkdir \/usr\/share\/tomcat<\/code><\/pre>\n\n\n\n
https:\/\/downloads.apache.org\/tomcat\/tomcat-9\/v9.0.50\/bin\/apache-tomcat-9.0.50.tar.gz<\/code><\/pre>\n\n\n\n
tar xzf apache-tomcat-9.0.50.tar.gz -C \/usr\/share\/tomcat --strip-components=1<\/code><\/pre>\n\n\n\n
chown -R tomcat:tomcat \/usr\/share\/tomcat<\/code><\/pre>\n\n\n\n
\ncat > \/etc\/systemd\/system\/tomcat.service << 'EOL'\n[Unit]\nDescription=Tomcat Server\nAfter=syslog.target network.target\n\n[Service]\nType=forking\nUser=tomcat\nGroup=tomcat\n\nEnvironment=JAVA_HOME=\/usr\/lib\/jvm\/jre\nEnvironment='JAVA_OPTS=-Djava.awt.headless=true'\nEnvironment=CATALINA_HOME=\/usr\/share\/tomcat\nEnvironment=CATALINA_BASE=\/usr\/share\/tomcat\nEnvironment=CATALINA_PID=\/usr\/share\/tomcat\/temp\/tomcat.pid\nEnvironment='CATALINA_OPTS=-Xms512M -Xmx1024M'\nExecStart=\/usr\/share\/tomcat\/bin\/catalina.sh start\nExecStop=\/usr\/share\/tomcat\/bin\/catalina.sh stop\n\n[Install]\nWantedBy=multi-user.target\nEOL\n<\/code><\/pre>\n\n\n\n
systemctl daemon-reload<\/code><\/pre>\n\n\n\n
systemctl start tomcat<\/code><\/pre>\n\n\n\n
systemctl status tomcat<\/code><\/pre>\n\n\n\n
\u25cf tomcat.service - Tomcat Server\n Loaded: loaded (\/etc\/systemd\/system\/tomcat.service; disabled; vendor preset: disabled)\n Active: active (running) since Sat 2021-07-24 07:28:00 EAT; 2min 3s ago\n Process: 42628 ExecStart=\/usr\/share\/tomcat\/bin\/catalina.sh start (code=exited, status=0\/SUCCESS)\n Main PID: 42633 (java)\n Tasks: 34 (limit: 11388)\n Memory: 86.3M\n CGroup: \/system.slice\/tomcat.service\n \u2514\u250042633 \/usr\/lib\/jvm\/jre\/bin\/java -Djava.util.logging.config.file=\/usr\/share\/tomcat\/conf\/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoa>\n\nJul 24 07:28:00 localhost.localdomain systemd[1]: Starting Tomcat Server...\nJul 24 07:28:00 localhost.localdomain systemd[1]: Started Tomcat Server.\n<\/code><\/pre>\n\n\n\n
Building Guacamole-Server on Rocky Linux 8<\/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
------------------------------------------------\nguacamole-server version 1.3.0\n------------------------------------------------\n\n Library status:\n\n freerdp2 ............ yes\n pango ............... yes\n libavcodec .......... no\n libavformat.......... no\n libavutil ........... no\n libssh2 ............. yes\n libssl .............. yes\n libswscale .......... no\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 .... no\n guaclog .... yes\n\n FreeRDP plugins: \/usr\/lib64\/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. If any error, fix it before you can proceed.<\/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 start guacd<\/code><\/pre>\n\n\n\n
systemctl status guacd<\/code><\/pre>\n\n\n\n
\u25cf guacd.service - Guacamole Server\n Loaded: loaded (\/etc\/systemd\/system\/guacd.service; disabled; vendor preset: disabled)\n Active: active (running) since Sat 2021-07-24 07:01:17 EAT; 6s ago\n Docs: man:guacd(8)\n Main PID: 41779 (guacd)\n Tasks: 1 (limit: 11388)\n Memory: 10.0M\n CGroup: \/system.slice\/guacd.service\n \u2514\u250041779 \/usr\/local\/sbin\/guacd -f\n\nJul 24 07:01:17 localhost.localdomain systemd[1]: Started Guacamole Server.\nJul 24 07:01:17 localhost.localdomain guacd[41779]: Guacamole proxy daemon (guacd) version 1.3.0 started\nJul 24 07:01:17 localhost.localdomain guacd[41779]: guacd[41779]: INFO: Guacamole proxy daemon (guacd) version 1.3.0 started\nJul 24 07:01:17 localhost.localdomain guacd[41779]: guacd[41779]: INFO: Listening on host 127.0.0.1, port 4822\nJul 24 07:01:17 localhost.localdomain guacd[41779]: Listening on host 127.0.0.1, port 4822\n<\/code><\/pre>\n\n\n\n
systemctl enable guacd<\/code><\/pre>\n\n\n\n
Installing Guacamole Client on Rocky Linux 8<\/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 \/usr\/share\/tomcat\/webapps\/<\/code><\/pre>\n\n\n\n
systemctl restart tomcat<\/code><\/pre>\n\n\n\n
systemctl restart guacd<\/code><\/pre>\n\n\n\n
Configure Apache Guacamole on Rocky Linux 8<\/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\/tomcat<\/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
cat > \/etc\/guacamole\/guacamole.properties << 'EOL'\nguacd-hostname: localhost\nguacd-port: 4822\nuser-mapping: \/etc\/guacamole\/user-mapping.xml\nauth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider\nEOL<\/code><\/pre>\n\n\n\n
ln -s \/etc\/guacamole \/usr\/share\/tomcat\/.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
printf '%s' password | md5sum<\/code><\/pre>\n\n\n\n
user-mapping.xml<\/code><\/strong>, with the following contents. <\/p>\n\n\n\n
\ncat> \/etc\/guacamole\/user-mapping.xml << 'EOL'\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 \n login to Guacamole Web UI-->\n <authorize \n username=\"guacadmin\"\n password=\"5f4dcc3b5aa765d61d8327deb882cf99\"\n encoding=\"md5\">\n\n <!-- First authorized Remote connection -->\n <connection name=\"Ubuntu 20.04 Server\">\n <protocol>ssh<\/protocol>\n <param name=\"hostname\">192.168.59.14<\/param>\n <param name=\"port\">22<\/param>\n <\/connection>\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>\n <param name=\"username\">koromicha<\/param>\n <param name=\"ignore-cert\">true<\/param>\n <\/connection>\n\n <\/authorize>\n\n<\/user-mapping>\nEOL\n<\/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 tomcat guacd<\/code><\/pre>\n\n\n\n
\/var\/log\/messages<\/strong><\/code> or
\/usr\/share\/tomcat\/logs\/catalina.*<\/strong><\/code> for any issues.<\/p>\n\n\n\n
Accessing Apache Guacamole from Browser<\/h3>\n\n\n\n
http:\/\/server-IP:8080\/guacamole<\/strong><\/code>.<\/p>\n\n\n\n
firewall-cmd --add-port=8080\/tcp --permanent<\/code><\/pre>\n\n\n\n
firewall-cmd --reload<\/a><\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
How to fix RDP server closed\/refused connection: Security negotiation failed (wrong security type?)<\/a><\/a><\/h3>\n\n\n\n
\/var\/log\/messages<\/code>.<\/p>\n\n\n\n
Jul 25 20:31:28 localhost guacd[3875]: guacd[4152]: WARNING:#011FreeRDP initialization may fail: The current user's home directory (\"\/sbin\") is not writable, but FreeRDP generally requires a writable home directory for storage of configuration files and certificates.\nJul 25 20:31:28 localhost guacd[4152]: No security mode specified. Defaulting to security mode negotiation with server.\nJul 25 20:31:28 localhost guacd[4152]: Resize method: none<\/strong><\/code><\/pre>\n\n\n\n
Jul 25 20:31:29 localhost guacd[4152]: RDP server closed\/refused connection: Security negotiation failed (wrong security type?)\nJul 25 20:31:29 localhost guacd[3875]: guacd[4152]: INFO:#011RDP server closed\/refused connection: Security negotiation failed (wrong security type?)<\/strong><\/code><\/pre>\n\n\n\n
daemon<\/code><\/strong> by default.<\/p>\n\n\n\n
ps aux | grep -v grep| grep guacd<\/code><\/pre>\n\n\n\n
daemon 4815 0.0 0.7 85404 14228 ? Ss 20:44 0:00 \/usr\/local\/sbin\/guacd -f<\/code><\/pre>\n\n\n\n
useradd -M -d \/var\/lib\/guacd\/ -r -s \/sbin\/nologin -c \"Guacd User\" guacd<\/code><\/pre>\n\n\n\n
mkdir \/var\/lib\/guacd<\/code><\/pre>\n\n\n\n
chown -R guacd: \/var\/lib\/guacd<\/code><\/pre>\n\n\n\n
sed -i 's\/daemon\/guacd\/' \/etc\/systemd\/system\/guacd.service<\/code><\/pre>\n\n\n\n
systemctl daemon-reload<\/code><\/pre>\n\n\n\n
systemctl restart guacd<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n