Saturday, June 03, 2017

HOWTO : Apache Guacamole Remote Desktop Gateway On Ubuntu 16.04 LTS

Apache Guacamole is a HTML5 remote desktop gateway. It supports VNC, RDP and SSH protocols. You can access your remote desktop or server by using standard browser. You are required a dedicate computer or virtual machine to setup the Guacamole server. This guide will use database authentication for the operation.

Step 1 :

Install Ubuntu Server 16.04.2 LTS as usual. It is recommended to install OpenSSH also.

sudo apt-get -y install libcairo2-dev libjpeg-turbo8-dev libpng12-dev libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libssh2-1-dev libvorbis-dev libwebp-dev autoconf autotools-dev libtool build-essential maven default-jdk mysql-common mysql-server mysql-client mysql-utilities tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-user ghostscript gsfonts gsfonts-other

Step 2 :

sudo mkdir -p /etc/guacamole
sudo mkdir -p /etc/guacamole/lib
sudo mkdir -p /etc/guacamole/extensions

Step 3 :

sudo nano /etc/default/tomcat8

Append the following lines at the end of the file :


Step 4 :

cd ~
git clone git://
cd incubator-guacamole-server
autoreconf -fi
./configure --with-init-dir=/etc/init.d
sudo make install
sudo ldconfig

sudo systemctl enable guacd

Step 5 :

cd ~
git clone git://
cd incubator-guacamole-client
mvn package

sudo cp ~/incubator-guacamole-client/guacamole/target/guacamole-0.9.12-incubating.war /etc/guacamole/
sudo ln -s /etc/guacamole/guacamole-0.9.12-incubating.war /var/lib/tomcat8/webapps/
sudo cp ~/incubator-guacamole-client/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/target/guacamole-auth-jdbc-mysql-0.9.12-incubating.jar /etc/guacamole/extensions/

Step 6 :

tar -xvzf mysql-connector-java-5.1.42.tar.gz
sudo cp mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar /etc/guacamole/lib/

sudo mkdir -p /usr/lib/x86_64-linux-gnu/freerdp
sudo ln -s /usr/local/lib/freerdp/* /usr/lib/x86_64-linux-gnu/freerdp/

Step 7 :

sudo mysql -u root -p
CREATE DATABASE guacamole_db;
CREATE USER 'guacamole_user'@'localhost' identified by '[GUACAMOLE_USER_PASSWORD]';
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'localhost';
flush privileges;

cd ~
cat ~/incubator-guacamole-client/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/*.sql | mysql -u root -p[MYSQL_ROOT_PASSWORD] guacamole_db

Step 8 :

sudo nano /etc/guacamole/

The content of the file is :

# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port: 4822

# MySQL Authentication
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole_db
mysql-username: guacamole_user

Step 9 :

sudo ln -s /var/lib/tomcat8/webapps/guacamole-0.9.12-incubating.war /var/lib/tomcat8/webapps/ROOT.war

Step 10 :

sudo systemctl restart guacd
sudo systemctl restart tomcat8

Step 11 : (The following Step 11 to 14 are for setting up VNC server on Ubuntu Desktop)

The Ubuntu Desktop will be accessed via VNC. Therefore, we need to install related packages on Ubuntu Desktop.

sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal tightvncserver

nano ~/.vnc/xstartup

The file content will be looking like :


xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work

vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
gnome-panel &
gnome-settings-daemon &
nautilus &
metacity &
gnome-session-flashback &

Reconfigure the session manager :

sudo update-alternatives --config x-session-manager

Select :


Step 12 :

sudo nano /lib/systemd/system/vncserver@.service

The file content will be looking like below. Making sure to replace "samiux" to your username :

Description=Start TightVNC server at startup

ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i


Step 13 :


Enter the password of VNC server when prompt and then answer "n" to the last question.

vncserver -kill :1

sudo systemctl daemon-reload
sudo systemctl enable vncserver@1.service

To start VNC server at port 5901 :

sudo systemctl start vncserver@1

Step 14 :

For streaming audio from Ubuntu Desktop :

sudo nano /etc/pulse/

Append the following line at the end of the file :

load-module module-native-protocol-tcp auth-anonymous=1

To restart PulseAudio :

pulseaudio -k

Port 4713 should be listening for connection. However, it is not very stable at my side.

Step 15 : (The following Step 15 is for setting up RDP on Kali Linux Xfce)

Install Kali Linux Xfce version, Gnome does not work. Lxde may works.

apt-get xrdp
systemctl enable xrdp
systemctl enable xrdp-sesman
systemctl start xrdp
systemctl start xrdp-sesman

update-alternatives --config x-session-manager

Make sure it is selected :


Step 16 :

To access the Guacamole, you point the browser to the Guacamole box, e.g. The username and password are both "guacadmin".

When accessing the remote desktop or server, you can launch the submenu by pressing :



Apache Guacamole Manual
How to install SSH ( secure shell ) service on Kali Linux

That's all! See you.