在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
The author selected Software in the Public Interest (SPI) to receive a donation as part of the Write for DOnations program. 作者选择了公益软件(SPI)来接受捐赠,这是Write for DOnations计划的一部分。 介绍 (Introduction)Usually, Linux-based servers don’t come with a graphical user interface (GUI) preinstalled. Whenever you want to run GUI applications on your instance, the typical solution is to employ Virtual Network Computing (VNC). Unfortunately, VNC is notoriously sluggish, insecure by default, and requires a lot of manual configuration to get up and running. 通常,基于Linux的服务器没有预先安装图形用户界面(GUI)。 每当您想在实例上运行GUI应用程序时,典型的解决方案就是采用虚拟网络计算(VNC)。 不幸的是,VNC非常缓慢,默认情况下不安全,并且需要大量的手动配置才能启动和运行。 By contrast, X2Go provides a working “cloud desktop,” complete with all the advantages of an always-online, remotely-accessible, and easily-scalable computing system with a very fast network. It is also more responsive and more secure than many VNC solutions. In this tutorial, you’ll use X2Go to create a Debian 10 XFCE desktop environment that you can access remotely. This “cloud desktop” will include the exact same utilities that you would obtain had you installed Debian 10 and the XFCE environment on your personal computer. 相比之下, X2Go提供了一个可运行的“云桌面”,并具有始终在线,可远程访问且易于扩展且具有快速网络的计算系统的所有优点。 与许多VNC解决方案相比,它还具有更高的响应速度和安全性。 在本教程中,您将使用X2Go创建可远程访问的Debian 10 XFCE桌面环境。 该“云桌面”将包含与在个人计算机上安装Debian 10和XFCE环境时将获得的完全相同的实用程序。 The setup described in this tutorial is useful when: 本教程中描述的设置在以下情况下很有用:
先决条件 (Prerequisites)Before starting this tutorial, you’ll need: 在开始本教程之前,您需要:
第1步-安装桌面环境 (Step 1 — Installing the Desktop Environment)With your server up and your firewall configured, you are now ready to install the graphical environment for the X2Go server. 在服务器启动并配置了防火墙之后,现在可以为X2Go服务器安装图形环境了。 In this tutorial, you are installing XFCE as the desktop environment. XFCE doesn’t use fancy graphical effects like compositing, which makes it more compatible with X2Go and allows it to optimize screen updates. For reference, 在本教程中,您将XFCE安装为桌面环境。 XFCE不使用合成等奇特的图形效果,这使其与X2Go更加兼容,并可以优化屏幕更新。 作为参考, There are two ways to easily install XFCE, but you only need to choose one—either the Minimal Desktop Environment or the Full Desktop Environment. 有两种方法可以轻松地安装XFCE,但是您只需选择一种-最小桌面环境或完整桌面环境。 Full Desktop Environment: Recommended. If you don’t want to handpick every component you need and would rather have a default set of packages, like a word processor, web browser, email client, and other accessories pre-installed, then you can choose 完整桌面环境:推荐。 如果您不想手动选择所需的每个组件,而是希望预先安装一套默认的软件包,例如字处理程序,Web浏览器,电子邮件客户端和其他附件,那么可以选择 Install and configure the Full Desktop Environment. This is similar to what you would get if you installed Debian from a bootable DVD/USB memory stick to your local PC: 安装和配置完整桌面环境。 这类似于从可启动DVD / USB记忆棒将Debian安装到本地PC时所获得的内容:
Minimal Desktop Environment: Alternately, if you want to install a small, core set of packages and then build on top of them by manually adding whatever you need afterward, you can use the 最小的桌面环境 :或者,如果您要安装一套小的核心软件包,然后通过手动添加所需的内容在它们之上构建,则可以使用 A metapackage doesn’t contain software of its own, it just depends on other packages to be installed, allowing for an entire collection of packages to be installed at once without having to type each package name individually at the command line. 元软件包不包含自己的软件,它仅取决于要安装的其他软件包,从而允许一次安装整个软件包集合,而不必在命令行中分别键入每个软件包名称。 Install 安装
Now that your graphical environment is installed, you will establish a way to view it remotely. 现在,您的图形环境已安装,您将建立一种远程查看它的方法。 第2步-在服务器上安装X2Go (Step 2 — Installing X2Go on the Server)X2Go comes with two main components: the server, which starts and manages the graphical session on the remote machine, and the client, which you install on your local computer to view and control the remote desktop or application. X2Go包含两个主要组件:服务器(用于启动和管理远程计算机上的图形会话),以及客户端(您可以将其安装在本地计算机上以查看和控制远程桌面或应用程序)。 In previous versions of Debian, 在以前的Debian版本中, To install X2Go on your server, type the following command: 要在服务器上安装X2Go,请键入以下命令:
At this point, no further setup is required on your server. However, keep in mind that since SSH password authentication is disabled, for increased security, you’ll need to have your SSH private key available on any machine that you want to log in from. This will be the case if you followed the recommendation of setting up SSH keys in the Initial Server Setup with Debian 10 tutorial listed in the prerequisites. If you didn’t, you can still log in with a password, but make sure you choose a strong one. 此时,不需要在服务器上进行进一步的设置。 但是,请记住,由于禁用了SSH密码身份验证,为了提高安全性,您需要在要登录的任何计算机上都可以使用SSH私钥。 如果您遵循先决条件中列出的“ 使用Debian 10进行初始服务器设置”教程中设置SSH**的建议,就会出现这种情况。 如果没有,您仍然可以使用密码登录,但是请确保选择一个安全的密码。 Remember that if you run out of RAM, some applications might be abruptly terminated by the Linux kernel, and then you could lose work in progress. If you are using a DigitalOcean Droplet and you notice that your programs require more RAM, you can temporarily power off your Droplet and upgrade (resize) to one with more memory. 请记住,如果RAM用完了,某些应用程序可能会被Linux内核突然终止,然后您可能会丢失正在进行的工作。 如果您使用的是DigitalOcean Droplet,并且您注意到程序需要更多的RAM,则可以暂时关闭Droplet的电源并升级(调整大小)到具有更多内存的内存。 You are now done setting up the server and you can type 现在,完成服务器的设置,您可以键入 步骤3 —在本地安装X2Go客户端 (Step 3 — Installing the X2Go Client Locally)X2Go is ready to use out of the box. If you’re using Windows or Mac on your local machine, you can download the X2Go client software here. If you’re using Debian or Ubuntu you can install the X2Go client with this command on your local machine: X2Go可以立即使用。 如果您在本地计算机上使用Windows或Mac,则可以在此处下载X2Go客户端软件。 如果您使用的是Debian或Ubuntu,则可以使用以下命令在本地计算机上安装X2Go客户端:
After downloading the software you are ready to install it. Open the installer and select your preferred language. Now agree to the license and let the wizard guide you through the remaining steps. Normally, there shouldn’t be any reason to change the pre-filled, default values in these steps. 下载软件后,您就可以安装它了。 打开安装程序,然后选择您的首选语言。 现在,同意许可,然后让向导引导您完成其余步骤。 通常,在这些步骤中应该没有任何理由更改预填充的默认值。 X2Go works well out of the box but it is also highly customizable. If you’d like additional information, visit X2Go’s official documentation. X2Go开箱即用,但高度可定制。 如果您需要其他信息,请访问X2Go的官方文档 。 Now that the desktop client is installed, you can configure its settings and connect to the X2Go server to use your remote XFCE desktop. 现在已经安装了桌面客户端,您可以配置其设置并连接到X2Go服务器以使用远程XFCE桌面。 步骤4 —连接到远程桌面 (Step 4 — Connecting To the Remote Desktop)When you first open the X2Go client, the following window will appear. If it doesn’t, click Session in the top-left menu and then select New session …. 首次打开X2Go客户端时,将出现以下窗口。 如果不是这样,单击会话在左上角的菜单,然后选择新建会话...。 In the Session name field, enter something to help differentiate between servers. This can be particularly useful if you plan on connecting to multiple machines. 在会话名称字段中,输入一些内容以帮助区分服务器。 如果您打算连接到多台计算机,这将特别有用。 Enter your server’s IP address or hostname in the Host field under Server. 在Host字段下服务器输入服务器的IP地址或主机名。 Enter the username you used for your SSH connection in the Login field. 在登录字段中输入用于SSH连接的用户名。 And, since you installed XFCE in Step Two, choose 并且,由于您在第二步中安装了XFCE,因此请选择 Finally, because you are connecting to the server with SSH keys, click the folder icon next to Use RSA/DSA key for ssh connection and browse to your private key. If you didn’t opt to use the more secure SSH keys, just leave this empty and the X2Go client will ask for a password each time you log in. 最后,由于要使用SSH**连接到服务器,因此请单击“ 使用RSA / DSA**进行ssh连接”旁边的文件夹图标,然后浏览至私钥。 如果您不选择使用更安全的SSH**,则将其保留为空,每次登录时X2Go客户端都会要求输入密码。 The rest of the default settings will suffice for now, but as you get more familiar with the software, you can fine tune the client based on your individual preferences. 其余的默认设置现在就足够了,但是随着您对软件的熟悉程度的提高,您可以根据个人喜好微调客户端。 After pressing the OK button, you can start your graphical session by clicking the white box that includes your session’s name on the top-right side of the box. 按下“ 确定”按钮后,您可以通过单击框右上角包含会话名称的白色框来启动图形会话。 If you are running OS X on your local machine, you may be prompted to install xquartz, which is required to run X11. If so, follow the instructions to install it now. 如果您在本地计算机上运行OS X,则系统可能会提示您安装xquartz,这是运行X11所必需的。 如果是这样,请按照说明立即安装。 In a few seconds, your remote desktop will be displayed and you can start interacting with it. During your first login, XFCE will ask if you want to Use default config or One empty panel. The first option will create a rectangular panel docked at the bottom of the screen, containing a few useful application shortcuts (e.g. a file manager, a terminal emulator, a browser, etc.). This option will also add a top panel to the desktop that includes utilities like an application launcher, a clock, a shutdown menu, and more. 几秒钟后,将显示您的远程桌面,您可以开始与它进行交互。 首次登录时,XFCE会询问您是否要使用默认配置或一个空白面板 。 第一个选项将创建一个停靠在屏幕底部的矩形面板,其中包含一些有用的应用程序快捷方式(例如,文件管理器,终端仿真器,浏览器等)。 此选项还将在桌面上添加一个顶面板,其中包括诸如应用程序启动器,时钟,关闭菜单等实用程序。 Unless you’re already familiar with XFCE, opting for an empty panel can be more complicated because you’ll be starting from scratch. There will be no taskbar, no clock, and no pre-configured start menu; it will be up to you to add everything to an empty panel on your own. 除非您已经熟悉XFCE,否则选择空白面板可能会更加复杂,因为您将从头开始。 没有任务栏,没有时钟,也没有预配置的开始菜单; 您可以自行将所有内容添加到空白面板中。 Additionally, on Windows and Linux-based operating systems, there are a few useful keyboard shortcuts you can use for a better experience: 此外,在基于Windows和Linux的操作系统上,可以使用一些有用的键盘快捷键来获得更好的体验:
即使您处于全屏模式,
Lastly, there are two ways you can end the remote session and close all of the graphical programs running in it. You can log off remotely from XFCE’s start menu, or you can click the button marked with a circle and a small line (like a power/standby icon) in the bottom-right corner of the main portion of the X2Go screen. 最后,您可以通过两种方式结束远程会话并关闭其中运行的所有图形程序。 您可以从XFCE的“ 开始”菜单中远程注销,也可以单击X2Go屏幕主要部分右下角带有圆圈和小线(如电源/待机图标)的按钮。 The first method is cleaner but may leave programs like session managing software running. The second method will close everything but may do so forcefully if a process can’t cleanly exit. In either case, be sure to save your work before proceeding. 第一种方法比较干净,但是可能会使诸如会话管理软件之类的程序运行。 第二种方法将关闭所有内容,但是如果进程无法干净退出,则可以强制执行此操作。 无论哪种情况,请确保在继续操作之前保存您的工作。 And lastly, although it’s not required, let’s go into XFCE’s control panel, navigate to power settings and disable all standby features. If you don’t use the desktop for a while, XFCE will try to trigger a standby. Although the server normally won’t do anything when it receives this request, it’s better to avoid any unforeseen behaviors altogether. 最后,尽管不是必需的,但让我们进入XFCE的控制面板,导航至电源设置并禁用所有待机功能。 如果您一段时间不使用桌面,则XFCE会尝试触发待机状态。 尽管服务器在收到此请求时通常不会执行任何操作,但最好完全避免任何无法预料的行为。 By going to the Applications menu, then Settings, you can open Power Manager. 通过转到“ 应用程序”菜单,然后转到“设置” ,可以打开“ 电源管理器” 。 In this application, navigate to the System tab and drag the When inactive for slider all the way to the left. You should now see the text Never under this slider, which means XFCE won’t try to put the system in standby after it’s inactive for a while. 在此应用程序中,导航到“ 系统”选项卡,并将“ 当不活动时”滑块一直拖动到最左侧。 现在,您应该在此滑块下看到“ 从不 ”文本,这意味着XFCE在一段时间处于非活动状态后,将不会尝试使系统处于待机状态。 You have now successfully accessed and configured your remote desktop. 现在,您已经成功访问和配置了远程桌面。 结论 (Conclusion)In this tutorial you used X2Go to create a robust and remote GUI-environment for the Debian operating system. Here are a few additional ideas about how to use this desktop. You could centralize your development work by creating a git repository, installing an IDE/code editor like NetBeans or Eclipse, or configuring a web server for testing web applications. You could also enhance your remote desktop with a good backup scheme to make sure that your work environment and important data are safely preserved in case something ever goes wrong. With DigitalOcean, you can also snapshot your Droplets when you’re happy with a certain setup. This way, you can test risky changes and always come back to a known good state in case you break something. 在本教程中,您使用X2Go为Debian操作系统创建了一个健壮的远程GUI环境。 以下是有关如何使用此桌面的一些其他想法。 您可以通过创建git存储库 ,安装IDE /代码编辑器(如NetBeans或Eclipse)或配置用于测试Web应用程序的Web服务器来集中开发工作。 您还可以使用良好的备份方案来增强远程桌面,以确保在出现问题时安全地保存您的工作环境和重要数据。 使用DigitalOcean,您还可以在对特定设置感到满意时对Droplet进行快照 。 这样,您可以测试有风险的更改,并在遇到问题时始终返回已知的良好状态。 If you’d like to learn more, visit X2Go’s official documentation website. 如果您想了解更多信息,请访问X2Go的官方文档网站 。 |
请发表评论