How to Install and Configure VNC on Ubuntu

Step 1 — Installing the Desktop Environment and VNC Server
sudo apt update
sudo apt install xfce4 xfce4-goodies
sudo apt install tightvncserver
sudo apt install xfce4 xfce4-goodies
sudo apt install tightvncserver
Run Vnc
vncserver
Output
Output
You will require a password to access your desktops.
Password:
Verify:
Output:
Output
Would you like to enter a view-only password (y/n)? n
xauth: file /home/sammy/.Xauthority does not exist
New 'X' desktop is your_hostname:1
Creating default startup script /home/sammy/.vnc/xstartup
Starting applications specified in /home/sammy/.vnc/xstartup
Log file is /home/sammy/.vnc/your_hostname:1.log
To kill vnc
vncserver -kill :1
Done
Troubleshoot: if connect with gray screen
Run
sudo apt install gnome-session-flashback
Add this to ~/.vnc/xstartup:
#!/bin/sh
autocutsel -fork
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
unset DBUS_SESSION_BUS_ADDRESS
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
autocutsel -fork
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
unset DBUS_SESSION_BUS_ADDRESS
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
Done, try to connect
Category: Tekno