1) Install packages
$ sudo apt update;sudo apt install --no-install-recommends ubuntu-desktop
$ sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal vnc4server
2) Edit /usr/bin/vncserver file and modify as below
Find this line
"# exec /etc/X11/xinit/xinitrc\n\n".
And add these lines below.
"gnome-session &\n".
"gnome-panel &\n".
"gnome-settings-daemon &\n".
"metacity &\n".
"nautilus &\n".
"gnome-terminal &\n".
3) Create VNC password and vnc session for the user using "vncserver" command.
lonely@ubuntu:~$ vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: file /home/lonely/.Xauthority does not exist
New 'ubuntu:1 (lonely)' desktop is ubuntu:1
Creating default startup script /home/lonely/.vnc/xstartup
Starting applications specified in /home/lonely/.vnc/xstartup
Log file is /home/lonely/.vnc/ubuntu:1.log
Now you can access GUI using IP/Domain and port 1
stackoverflow.com:1
Tested on AWS and digital ocean .
For AWS, you have to allow port 5901 on firewall
To kill session
$ vncserver -kill :1
Refer:
https://linode.com/docs/applications/remote-desktop/install-vnc-on-ubuntu-16-04/
Refer this guide to create permanent sessions as service
http://www.krizna.com/ubuntu/enable-remote-desktop-ubuntu-16-04-vnc/