https://www.e2enetworks.com/help/knowledge-base/how-to-install-remote-desktop-xrdp-on-ubuntu-18-04/
https://www.linode.com/docs/guides/install-vnc-on-ubuntu-16-04/
https://blog.csdn.net/weixin_41879093/article/details/108891958
https://command-not-found.com/netfilter-persistent
This guide explains how to install a graphic desktop environment on your running Ubuntu 18.04 and how to connect to it from your local computer using VNC.
Before You Begin,
- Familiarize yourself with our Getting Started guide and complete the steps for setting your server’s hostname and timezone.
- Complete the sections of our Securing Your Server guide to create a standard user account, harden SSH access and remove unnecessary network services.
- Update your system.
sudo apt-get update && sudo apt-get upgrade
Install a Desktop and VNC Server on your Ubuntu Machine
- Ubuntu has several desktop environments available in its repositories. The following command installs the default desktop, Unity, as well as the dependencies that are required for the graphical interface to work properly:
sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
During the install process, you will be asked whether or not to change a system file to the new version:
Configuration file '/etc/init/tty1.conf'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** tty1.conf (Y/I/N/O/D/Z) [default=N] ?
Type y then enter to use the updated version.
- Install the VNC server:
sudo apt-get install vnc4server
You’re done!
Secure your VNC connection
The VNC server generates a display, or graphical output, identified by a number that is defined when the server starts. If no display number is defined, the server will use the lowest one available. VNC connections take place on port 5900 + display. This guide will use a display number of 1; therefore, you will connect to remote port 5901.
The default VNC connection is unencrypted. In order to secure your passwords and data, you will need to tunnel the traffic through an SSH connection to a local port. You can use the same local port for consistency.
Windows
Open PuTTY and navigate to Tunnels under the SSH section in the menu. Add a new forwarded port as shown below, replacing example.com with your server’s IP address or hostname:
