Linux simple application servers provide only CLIs. If you want to use a GUI to manage the Linux OS of your simple application server, you can use Virtual Network Console (VNC) to build a GUI. This topic describes how to build an Ubuntu GUI.
Prerequisites
A simple application server that runs the Ubuntu 18.04 or Ubuntu 20.04 OS and has the specification of 1 vCPU and 2 GB of memory or higher specification is created. For more information, see Create a server.
Firewall rules are added to the firewall of the Ubuntu server to allow traffic from ports 5900 and 5901. These ports are required by the VNC service. For more information, see the "Add a firewall rule" section of the Manage the firewall of a server topic.
Background information
This topic describes how to use VNC to build an Ubuntu 18.04 or Ubuntu 20.04 GUI. This topic also shows how to use VNC Viewer to connect to the GUI from an on-premises Windows machine. For information about how to use VNC to build an Ubuntu 16.04 GUI, see Use VNC to build an Ubuntu 16.04 GUI.
Step 1: Build a GUI
Connect to your Ubuntu server as the
root
user.For more information, see the "(Recommended) Connect to a Linux server by using Workbench in the Simple Application Server console" section of the Connect to a Linux server topic.
Install the software package.
Run the following command to update the software repository:
apt-get update
Run the following command to install the software package for the desktop environment.
The software package includes desktop applications, such as a system panel, window manager, file browser, and terminals.
apt install -y gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal ubuntu-desktop
Configure VNC.
Run the following command to install VNC:
Ubuntu 18.04
apt-get install vnc4server
Ubuntu 20.04
apt-get install tightvncserver
When the following message appears, enter Y and press Enter.
Run the following command to start VNC:
vncserver
The first time you start VNC, you must set a logon password for VNC. Enter a logon password and verify the password. Enter n in the following message and press Enter.
ImportantThe logon password of VNC can be up to eight characters in length. If the string that you specify contains more than eight characters, VNC uses the first eight characters of the string as the password.
If the command output includes the information shown in the following figure, VNC is started.
izbp166dsac66tx****:1 indicates the display ID of the VNC session that is started on the server. izbp166dsac66tx**** is the hostname.
Run the following command to back up the xstartup configuration file of VNC:
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
Run the following command to modify the xstartup configuration file of VNC:
vim ~/.vnc/xstartup
Press I to enter the edit mode and replace the content of the configuration file with the following content.
#!/bin/sh export XKL_XMODMAP_DISABLE=1 export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME" export XDG_MENU_PREFIX="gnome-flashback-" gnome-session --session=gnome-flashback-metacity --disable-acceleration-check &
Press the Esc key, enter
:wq
, and then press the Enter key to save and close the file.
Restart VNC.
Run the following command to close the active VNC session:
vncserver -kill :1
Run the following command to start a new VNC session:
The display ID of the new VNC session remains as 1.
vncserver -geometry 1920x1080 :1
Step 2: Use VNC Viewer to access the Ubuntu server
Download and install VNC Viewer on your on-premises Windows computer.
You can visit the official VNC website to obtain the download link and installation instructions for VNC Viewer.
Start VNC Viewer. In the top navigation bar, choose
In the Properties dialog box, configure the logon information about the Ubuntu desktop and click OK.
You must configure the following parameters:
VNC Server: Enter <The public IP address of the Ubuntu server>:<The port number of VNC>. Example:
114.55.XX.XX:5901
. For information about how to obtain the public IP address of an Ubuntu server, see the "How do I obtain the public IP address of my simple application server" section of the FAQ topic.Name: Enter a name for the Ubuntu desktop. Example:
test001
.
Double-click the card of the Ubuntu desktop.
In this example, double-click the card of the Ubuntu desktop named
test001
.In the Authentication dialog box, enter the logon password of VNC in the Password field and click OK.
After you log on to the Ubuntu server, you can see the Ubuntu GUI, as shown in the following figure. If you want to open a terminal in the Ubuntu GUI, you can right-click the blank area in the Ubuntu GUI and select Open Terminal.
If you cannot use VNC Viewer to access the Ubuntu server, perform the following operations to troubleshoot the problem:
Check whether ports 5900 and 5901 are enabled in the firewall of the Ubuntu server. These ports are required by the VNC service. For more information, see the "Add a firewall rule" section of the Manage the firewall of a server topic.
Check whether a firewall is configured on your on-premises computer.
Check whether your on-premises computer can ping the public IP address of the Ubuntu server.
For more information, see FAQ.