If you want to visualize your operations, design graphics, process multimedia materials, or perform routine office tasks or you are unfamiliar with commands, you can use a GUI desktop. This significantly improves user experience and work efficiency. To ensure performance and versatility, GUI desktop components, including GNOME, KDE Plasma, MATE Desktop, and Ubuntu Desktop, are not pre-installed in public Linux images provided by Alibaba Cloud for Elastic Compute Service (ECS). This topic describes how to install a GUI desktop on ECS instances that run mainstream Linux operating systems and how to resolve installation issues.
Introduction to and basic components of a GUI desktop
What is a Linux GUI desktop?
In a Linux operating system, a GUI desktop is an interface that allows users to interact with the operating system by using graphical elements, such as windows, icons, buttons, and menus. A Linux GUI desktop is similar to a Windows GUI desktop. A GUI desktop is more intuitive and user-friendly than the traditional command-line interface (CLI) and is suitable for most routine operations.
Main components of a GUI desktop
Display server
A display server is responsible for managing graphical display effects and input devices. Common display servers include Xorg, which is an implementation of the X11 protocol, and Wayland. The implementation of the X11 protocol is the basis of Linux graphical environments and is responsible for managing display effects, input devices such as keyboards and mouses, and window rendering. Wayland is a newer display protocol designed to replace the X11 protocol. Wayland provides higher efficiency, better security, and smoother graphics experience than X11. A number of modern desktop environments support Wayland.
Window manager
A window manager is responsible for managing the appearances and behaviors of windows, such as the movement, resizing, and minimization of windows. A window manager can be standalone or integrated in the desktop environment.
Desktop environment
A desktop environment is a collection of components, including the window manager, icons, toolbars, and system settings, that work together to provide consistent user experience. Common desktop environments include GNOME, KDE Plasma, Xfce, and LXDE.
Application framework and toolkit
A GUI desktop contains a variety of application and system components, such as text editors, browsers, file managers, and multimedia players. The components together provide a complete graphical user experience.
Common desktop environments
GNOME
GNOME is a modern, simplified, and user-centric desktop environment. GNOME uses the GTK toolkit and has an own set of applications, such as Nautilus File Manager and GNOME Terminal. GNOME focuses on consistency and ease of use and is suitable for beginners and users who want a simple interface. For more information, see GNOME.
KDE Plasma
KDE Plasma is a feature-rich, highly customizable desktop environment based on the Qt toolkit. KDE Plasma provides a rich ecosystem of applications, such as Dolphin File Manager and Konsole Terminal. KDE Plasma is suitable for users who require a high degree of customization and rich functionality. For more information, see The KDE Plasma desktop.
Xfce
Xfce is a lightweight, low-resource desktop environment suitable for old hardware or systems that require high performance. Xfce provides basic desktop functionality, supports the GTK toolkit, and balances performance and user experience. For more information, see Xfce Desktop.
LXDE and LXQt
LXDE and LXQt are lightweight desktop environments suitable for low-resource systems. LXDE is based on the GTK toolkit, and LXQt is based on the Qt toolkit to provide a fast and simplified user interface. For more information, see LXQt.
MATE Desktop
Based on GNOME 2, MATE Desktop adopts the traditional desktop layout and is stable and lightweight. MATE Desktop is suitable for users who prefer classic desktop experience. Supported application editions include Ubuntu MATE and Linux Mint MATE editions. For more information, see MATE Desktop.
Precautions
ECS instances that run Alibaba Cloud Linux operating systems do not support GUI desktop installation.
Before you install a GUI desktop on an ECS instance, we recommend that you create snapshots for the instance to back up your data. For more information, see Create a snapshot.
A GUI desktop depends on a large number of components. However, installing a large number of components on an ECS instance may degrade the performance of the instance. If you do not properly install the components, the operating system may not start as expected. Proceed with caution.
After you install a GUI desktop on an ECS instance, the GUI desktop automatically appears when you connect to the instance by using Virtual Network Computing (VNC). If you connect to the instance by using Workbench or Session Manager, the GUI desktop does not automatically appear.
The following sections describe how to install a GUI desktop on ECS instances that run CentOS 7, CentOS 8, Ubuntu 14, Ubuntu 18, Ubuntu 20, and Ubuntu 22. The operations that you must perform to install a GUI desktop may vary for other distributions For more information, see the official documentation of the corresponding distribution.
CentOS 6 and CentOS 8 have reached their end of life (EOL). In accordance with Linux community rules, all content were removed from the default CentOS 6 and CentOS 8 repository addresses. If you continue to use the default repository addresses of CentOS 6 or CentOS 8, an error is reported. We recommend that you change the repository addresses of CentOS 6 or CentOS 8. For more information, see How do I change CentOS 6 repository addresses? or Change CentOS 8 repository addresses.
Install a GUI desktop on a CentOS 7 instance
This section describes how to install a MATE Desktop environment on an ECS instance that runs CentOS 7. The operations that you must perform to install a GUI desktop may vary for other distributions. For more information, see the official documentation of the corresponding distribution.
Connect to a CentOS 7 instance by using VNC. For more information, see Connect to an instance by using VNC.
Run the following command to update the software packages in the operating system:
sudo yum -y upgrade
Run the following commands in sequence to install a MATE Desktop environment:
sudo yum groups install "X Window System" sudo yum groups install "MATE Desktop"
Run the following command to set the default boot target to the GUI mode: You can run the
systemctl set-default multi-user.target
command to set the default boot target to the multi-user (text-based) mode.sudo systemctl set-default graphical.target
Run the following command to restart the ECS instance:
sudo reboot
Wait until the system restart is complete. If the GUI desktop appears, the installation is successful.
NoteYou can enter the username and password of the instance to connect to the instance without the need to provide the VNC logon password.
Install a GUI desktop on a CentOS 8 instance
This section describes how to install a GUI desktop on an ECS instance that runs CentOS 8. The operations that you must perform to install a GUI desktop may vary for other distributions. For more information, see the official documentation of the corresponding distribution.
Connect to a CentOS 8 instance by using VNC. For more information, see Connect to an instance by using VNC.
Run the following command to update the software packages in the operating system:
sudo yum -y upgrade
Run the following command to install the GUI desktop package:
sudo yum groupinstall "Server with GUI" -y
Run the following command to set the default boot target to the GUI mode. You can run the
systemctl set-default multi-user.target
command to set the default boot target to the multi-user (text-based) mode.sudo systemctl set-default graphical.target
Run the following command to restart the ECS instance:
sudo reboot
Wait until the system restart is complete. If the GUI desktop appears, the installation is successful.
NoteYou can enter the username and password of the instance to connect to the instance without the need to provide the VNC logon password.
Install a GUI desktop on a Ubuntu 14 instance
This section describes how to install a GNOME desktop on an ECS instance that runs Ubuntu 14. The operations that you must perform to install a GUI desktop may vary for other distributions. For more information, see the official documentation of the corresponding distribution.
Connect to a Ubuntu 14 instance by using VNC. For more information, see Connect to an instance by using VNC.
Run the following command to update the software repository:
sudo apt-get update
Run the following commands in sequence to install a GNOME desktop environment:
sudo apt-get install x-window-system-core sudo apt-get install gnome-core
Run the following command to start the GUI desktop:
sudo startx
Run the following command to restart the ECS instance:
sudo reboot
Wait until the system restart is complete. If the GUI desktop appears, the installation is successful.
NoteYou can enter the username and password of the instance to connect to the instance without the need to provide the VNC logon password.
Install a GUI desktop on a Ubuntu 18, Ubuntu 20, Ubuntu 22, or Ubuntu 24 instance
This section describes how to install a Ubuntu Desktop environment on an ECS instance that runs Ubuntu 18. The operations that you must perform to install a GUI desktop may vary for other distributions. For more information, see the official documentation of the corresponding distribution.
Connect to a Ubuntu 18 instance by using VNC. For more information, see Connect to an instance by using VNC.
Run the following command to update the software repository:
sudo apt-get update
Run the following command to install a GUI desktop:
sudo apt-get install ubuntu-desktop
If the "unmet dependencies" error is reported during the installation process, use the solution described in the FAQ section of this topic to resolve the issue. Then, start the GUI desktop.
Run the following command to set the default boot target to the GUI mode. You can run the
systemctl set-default multi-user.target
command to set the default boot target to the multi-user (text-based) mode.sudo systemctl set-default graphical.target
Run the following command to restart the ECS instance:
sudo reboot
Wait until the system restart is complete. If the GUI desktop appears, the installation is successful.
NoteYou can enter the username and password of the instance to connect to the instance without the need to provide the VNC logon password.
The welcome page shown in the following figure indicates that the GUI desktop is installed.
Repeatedly click Next to accept the default settings.
The interface shown in the following figure indicates that the GUI desktop is installed and available for use.
Install a GUI desktop on an Anolis 8 instance
Anolis 8 is based on Red Hat Enterprise Linux (RHEL) and CentOS 8. You can use the Dandified YUM (DNF)
package manager to install a desktop environment. To install a GUI desktop, such as the GNOME desktop, on an ECS instance that runs Anolis 8, perform the following steps:
Connect to an Anolis 8 instance by using VNC. For more information, see Connect to an instance by using VNC.
Update the software packages in the operating system.
sudo dnf update -y
Install a GUI desktop environment.
sudo dnf groupinstall "Server with GUI" -y
You can also install a different desktop environment, such as KDE Plasma. Sample command:
sudo dnf groupinstall "KDE Plasma Workspaces" -y
To view all available desktop environment groups, run the following command:
sudo dnf group list
Set the default boot target to the GUI mode.
After the installation is complete, set the default boot target of the system to the GUI mode.
sudo systemctl set-default graphical.target
Start the GUI desktop.
If you immediately switch to the GUI desktop, you do not need to restart the operating system.
sudo systemctl isolate graphical.target
If you want to switch to the GUI desktop by restarting the operating system, run the following command:
sudo reboot
(Optional) Install additional graphical tools.
After the installation is complete, you may need to install additional graphical tools or drivers to ensure that the GUI desktop smoothly runs. For example, run the following command to install graphical drivers:
sudo dnf install xorg-x11-drv-* -y
Wait until the system restart is complete. If the GUI desktop appears, the installation is successful.
NoteYou can enter the username and password of the instance to connect to the instance without the need to provide the VNC logon password.
Run the following commands to ensure that the GUI service is started and running:
sudo systemctl status gdm sudo systemctl start gdm
Check the current default boot target to ensure that
graphical.target
is returned.sudo systemctl get-default
Check logs.
If issues occur, you can view the related logs for more information.
sudo journalctl -xe
After you complete the preceding steps, Anolis 8 starts and enters the GUI desktop.
FAQ
What do I do if I cannot use my keyboard or mouse after I install a GUI desktop on a CentOS instance?
Problem description
When you connect to an ECS instance by using VNC in the ECS console after you install a GUI desktop on the instance, you cannot use your keyboard or mouse.
Cause
An exception related to the driver of the keyboard or mouse occurs.
Solution
Perform the following steps to change the driver type to evdev:
Run the following command to install the evdev program:
yum install xorg-x11-drv-evdev
Run the following command to create the
/etc/X11/xorg.conf
configuration file:Xorg -configure
Run the following command to back up the configuration file:
cp xorg.conf.new /etc/X11/xorg.conf
Modify the
/etc/X11/xorg.conf
configuration file and change the type of the mouse and keyboard drivers to evdev.Identifier "Keyboard0" Driver "evdev" # Change the driver type to evdev. Option "Device" "/dev/input/event3" EndSection Section "InputDevice" Identifier "Mouse0" Driver "evdev" # Change the driver type to evdev. Option "Device" "/dev/input/event5" Option "Mode" "Absolute" EndSection
The following figure shows a sample configuration file before modification.
The following figure shows a sample configuration file after modification.
Restart the ECS instance and check whether you can use the mouse and keyboard.
What do I do if I cannot use the GNOME desktop on a CentOS instance because the messagebus and haldaemon services are not started on system startup?
Problem description
After you install the GNOME desktop environment on a CentOS instance and restart the instance, you cannot connect to the instance even if you provide the correct username and password. The following error message appears:
"You are currently trying to run as the root super user. The super user is a specialized account that is not designed to run a normal user session. Various programs will not function properly, and actions performed under this account can cause unrecoverable damage to the operating system."
Cause
The preceding issue occurs because the messagebus and haldaemon services are not automatically started on system startup. To improve system performance and stability, the messagebus and haldaemon services are not configured to automatically start on system startup in Linux public images.
Solution
Use a snapshot created before you install the GUI desktop to roll back the operating system. For more information, see Roll back a disk by using a snapshot.
Perform the operations described in this topic to re-install the GUI desktop.
Run the following commands to configure the messagebus and haldaemon services to automatically start on system startup:
chkconfig --level 35 messagebus on chkconfig --level 35 haldaemon on
NoteWe recommend that you set the boot level to level 3 and start the desktop environment by running the
startx
command to test the availability of the desktop environment. If an issue occurs, you can switch to the text-based mode to identify and troubleshoot the issue. After you confirm that the desktop environment starts as expected, change the boot level to level 5.
What do I do if the "unmet dependencies" error occurs when I install a GUI desktop on a Ubuntu instance?
Problem description
An error is reported when you install a GUI desktop on a Ubuntu 18 instance, as shown in the following figure.
Cause
Recent versions of the update-manager-core, libparted2, and python3-update-manager packages exist on the instance. However, previous versions of the packages are required to install the GUI desktop for Ubuntu 18. You must delete the recent versions of the packages so that the operating system re-installs software packages based on the software package dependency tree.
Solution
Run the following command to uninstall the recent versions of the update-manager-core, libparted2, and python3-update-manager packages:
apt-get remove update-manager-core libparted2 python3-update-manager
Run the following commands to re-install the GUI desktop:
apt-get update apt-get install ubuntu-desktop
What do I do if the "Invalid configuration value: failovermethod=priority" error message appears?
When you run the yum groupinstall "Server with GUI" -y
command, the Invalid configuration value: failovermethod=priority
error message appears.
Problem description
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
CentOS Linux 8 - AppStream
Cause
An invalid configuration option (failovermethod=priority
) exists in the configuration file of the Extra Packages for Enterprise Linux (EPEL) repository. The path of the configuration file is /etc/yum.repos.d/CentOS-epel.repo
. In CentOS 8, the Yellowdog Updater Modified (YUM)
package manager is based on the DNF
package manager. The DNF
package manager no longer supports the failovermethod
configuration option. When the DNF
package manager parses the configuration file of the EPEL repository, the preceding error is reported.
Solution
Modify the configuration file of the EPEL repository to remove or comment out the failovermethod=priority
line. Perform the following steps:
Modify the configuration file of the EPEL repository.
Open the
/etc/yum.repos.d/CentOS-epel.repo
file by using your preferred text editor, such as vim or nano. Example:sudo vi /etc/yum.repos.d/CentOS-epel.repo
Find and remove the
failovermethod=priority
line.In the configuration file of the EPEL repository, find the line that contains the
failovermethod=priority
configuration option. Use one of the following methods to comment out or delete the line:Add the comment symbol (
#
) to the beginning of the line to comment out the line.# failovermethod=priority
Delete the line that contains the
failovermethod=priority
configuration option.
# Save and close the file.
If you use the
vim
editor, press theEsc
key, enter:wq
, and then press the Enter key to save and close the file.If you use the
nano
editor, pressCtrl+O
to save the change and then pressCtrl+X
to close the file.
Clear the YUM or DNF cache.
Run the following commands to clear the cache and ensure that the new configurations take effect:
sudo yum clean all sudo yum makecache
You can also run the following
dnf
commands:sudo dnf clean all sudo dnf makecache
Re-install the GUI desktop.
sudo yum groupinstall "Server with GUI" -y
How to resolve the stuttering issue
After you install a graphical user interface, a stuttering issue may happen. This may be due to the high resource consumption of the selected desktop environment or low system configuration.
Xrdp can invoke the Remote Desktop (mstsc) program that comes with Windows, providing better stability. Especially in good network conditions, Xrdp can provide a smoother experience for remote use. Refer to the following commands to install Xrdp:
sudo apt install xrdp -y
sudo adduser xrdp ssl-cert
sudo ufw allow 3389/tcp
sudo systemctl status xrdp
sudo systemctl enable xrdp
If the Linux system lacks sufficient resources or the desktop environment is too heavy, we recommend that you use a more lightweight desktop environment to improve performance.
References
Refer to the following topics, which guide you on how to build a GUI on a simple application server and use the tool of Virtual Network Console (VNC) Viewer to access the server.