From a8b95fcb81306a46acdf78f5005341aaa1839086 Mon Sep 17 00:00:00 2001
From: emanuele <emanuele.petagna@garr.it>
Date: Mon, 7 Feb 2022 17:25:28 +0100
Subject: [PATCH] Added "How to get a Graphical GUI for your OpenStack VM
 (tested on Ubuntu 20.04 server)"

---
 web/support/FAQ.rst | 63 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/web/support/FAQ.rst b/web/support/FAQ.rst
index a1923815..4c7613ae 100644
--- a/web/support/FAQ.rst
+++ b/web/support/FAQ.rst
@@ -652,3 +652,66 @@ I have registered through the Form-based registration and now I am trying to log
 Please enter `cloudusers` in the domain field.
 
 
+How to get a Graphical GUI for your OpenStack VM (tested on Ubuntu 20.04 server)
+----------------------------------------------------------------------------
+This FAQ explains how to install a grphical Environment and VNC on an OpenStack instance and how to access 
+it without exposing VNC service to the Internet.
+Requirements for local machine:
+- a VNC Client (Remmina, TigerVNC, ChickenOfTheVNC...)
+- an SSH Client
+The following instructions work straightforward on Linux and MacOS; on Windows some adjustements are required, 
+it depends on your SSH Client.
+
+**XFCE4 Desktop Environment**
+1. SSH login to your OpenStack VM
+2. install XFCE4: `sudo apt-get install xfce4 xfce4-goodies gnome-icon-theme tigervnc-standalone-server` 
+     [if you need a more complete desktop environment then install also **xubuntu-desktop**]
+3. create a .vnc folder in your user home: `mkdir .vnc`
+4. create xstartup file in `~/.vnc/` and paste the following content:
+:: 
+    #!/bin/bash
+    xrdb $HOME/.Xresources
+    startxfce4 & ::
+
+5. run `vncpasswd` and set VNC password (you can skip the viewer password)
+6. run `vncserver -geometry WIDTHxHEIGHT -localhost yes -rfbport PORT`, replace **WIDTH** and **HEIGHT** with 
+     desired values (ex: 1024x768) and PORT (ex: 5901, default port)
+7. on your local machine run: `ssh -L LOCAL_PORT:127.0.0.1:PORT USER@VM_IP`; choose a port and replace 
+**LOCAL_PORT** with a valid port; replace **PORT** with the same port used in previous step.
+8. on your local machine run a VNC Client and connect to **127.0.0.1:LOCAL_PORT**, when required insert VNC password (from step 5)
+
+
+**GNOME Desktop Environment**
+1. SSH login to your OpenStack VM
+2. install XFCE4: `sudo apt-get install ubuntu-gnome-desktop gnome-icon-theme tigervnc-standalone-server`
+3. create a .vnc folder in your user home: `mkdir .vnc`
+4. create xstartup file in `~/.vnc/` and paste the following content:
+:: 
+    #!/bin/sh
+    # Start Gnome 3 Desktop 
+    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
+    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
+    vncconfig -iconic &
+    dbus-launch --exit-with-session gnome-session &
+
+5. run `vncpasswd` and set VNC password (you can skip the viewer password)
+6. run `vncserver -geometry WIDTHxHEIGHT -localhost yes -rfbport PORT`, replace **WIDTH** and **HEIGHT** with 
+     desired values (ex: 1024x768) and PORT (ex: 5901, default port)
+7. on your local machine run: `ssh -L LOCAL_PORT:127.0.0.1:PORT USER@VM_IP`; choose a port and replace 
+**LOCAL_PORT** with a valid port; replace **PORT** with the same port used in previous step.
+8. on your local machine run a VNC Client and connect to **127.0.0.1:LOCAL_PORT**, when required insert VNC password (from step 5)
+
+When you do not need anymore VNC you can kill it, on your OpenStack VM:
+1. run `vncserver --list`, you should get a list of active VNC displays
+::
+testuser@test-gui:~$ vncserver --list
+
+TigerVNC server sessions:
+
+X DISPLAY #	RFB PORT #	PROCESS ID
+:2		5902		36811
+::
+2. kill the proper VNC display: `vncserver -kill :DISPLAY`, replace **DISPLAY** with correct value (ex: 2 in our example)
+3. logout
+
+To restart VNC server just login and follow steps from 6. to 8..
\ No newline at end of file
-- 
GitLab