介绍 (Introduction)
Virtual Network Computing, or VNC, is a connection system that allows you to use your keyboard and mouse to interact with a graphical desktop environment on a remote server. It makes managing files, software, and settings on a remote server easier for users who are not yet comfortable with the command line.
虚拟网络计算 (VNC)是一种连接系统,使您可以使用键盘和鼠标与远程服务器上的图形桌面环境进行交互。 对于尚不熟悉命令行的用户,它使在远程服务器上管理文件,软件和设置更加容易。
In this guide, you’ll set up a VNC server with TightVNC on an Ubuntu 20.04 server and connect to it securely through an SSH tunnel. Then, you’ll use a VNC client program on your local machine to interact with your server through a graphical desktop environment.
在本指南中,您将在Ubuntu 20.04服务器上使用TightVNC设置VNC服务器,并通过SSH隧道安全地连接到该服务器。 然后,您将使用本地计算机上的VNC客户端程序通过图形桌面环境与服务器进行交互。
先决条件 (Prerequisites)
To complete this tutorial, you’ll need:
要完成本教程,您需要:
One Ubuntu 20.04 server with a non-root administrative user and a firewall configured with UFW. To set this up, follow our initial server setup guide for Ubuntu 20.04.
一台Ubuntu 20.04服务器,具有非root用户和配置了UFW的防火墙。 要进行设置,请遵循我们针对Ubuntu 20.04的初始服务器设置指南 。
步骤1 —安装桌面环境和VNC服务器 (Step 1 — Installing the Desktop Environment and VNC Server)
By default, an Ubuntu 20.04 server does not come with a graphical desktop environment or a VNC server installed, so you’ll begin by installing those.
默认情况下,Ubuntu 20.04服务器未安装图形桌面环境或VNC服务器,因此从安装它们开始。
You have many options when it comes to which VNC server and desktop environment you choose. In this tutorial, you will install packages for the latest Xfce desktop environment and the TightVNC package available from the official Ubuntu repository. Both Xfce and TightVNC are known for being lightweight and fast, which will help ensure that the VNC connection will be smooth and stable even on slower internet connections.
选择哪种VNC服务器和桌面环境时,您有很多选择。 在本教程中,您将安装适用于最新Xfce桌面环境的软件包以及官方Ubuntu存储库中提供的TightVNC软件包。 Xfce和TightVNC都以轻便,快速而著称,这将有助于确保即使在互联网连接速度较慢的情况下,VNC连接也将保持平稳。
After connecting to your server with SSH, update your list of packages:
使用SSH连接到服务器后,更新软件包列表:
- sudo apt update sudo apt更新
Now install Xfce along with the xfce4-goodies
package, which contains a few enhancements for the desktop environment:
现在,将Xfce与xfce4-goodies
软件包一起安装,其中包含针对桌面环境的一些增强功能:
- sudo apt install xfce4 xfce4-goodies sudo apt安装xfce4 xfce4-goodies
During installation, you may be prompted to choose a default display manager for Xfce. A display manager is a program that allows you to select and log in to a desktop environment through a graphical interface. You’ll only be using Xfce when you connect with a VNC client, and in these Xfce sessions you’ll already be logged in as your non-root Ubuntu user. So for the purposes of this tutorial, your choice of display manager isn’t pertinent. Select either one and press ENTER
.
在安装过程中,系统可能会提示您选择Xfce的默认显示管理器。 显示管理器是一个程序,允许您通过图形界面选择并登录到桌面环境。 仅在与VNC客户端连接时使用Xfce,并且在这些Xfce会话中,您已经以非root用户Ubuntu用户身份登录。 因此,就本教程而言,与显示管理器的选择无关。 选择其中一个,然后按ENTER
。 </