All Products
Search
Document Center

:Installing a graphical desktop environment for a Linux instance

Last Updated:Dec 16, 2020

Introduction

This article describes how to install the graphical desktop environment on Linux instances.

Background

For the sake of performance and versatility, the graphical desktop component is not installed in the public Linux images officially provided by Alibaba Cloud by default. You can install a graphical desktop for common Linux instances according to your actual needs. For more information, see the following figure.

Note:

  • The graphical desktop can significantly degrade the performance of the server. If improperly installed, the operating system may fail to start. Before installation, we recommend that you create snapshot backups for the ECS instances in case the restoration can be rolled back when exceptions occur.
  • This topic takes CentOS8, CentOS7, and Ubuntu14 as an example. The actual conditions may vary.

CentOS 8

For information about the CentOS 8 system, see CentOS 8 installation Gui.

CentOS 7

In this example, install the MATE desktop environment as follows.

Note: After the installation and restart, if the card is displayed on the startup page, run the following command to update the system software package.

yum -y upgrade
  1. Establish a remote connection and log on to the Linux instance.
  2. Run the following commands in sequence to install the MATE desktop environment.
    yum groups install "X Window System"
    yum groups install "MATE Desktop"
  3. Run the following command. By default, the system uses the graphical desktop environment.
    systemctl set-default graphical.target
  4. Run the reboot command to restart the ECS instance. Alternatively, you can restart an instance in the ECS console.
  5. Connect to the ECS instance through the management terminal in the ECS console and confirm that the desktop environment is successfully installed.

Ubuntu 14

In this example, install GNOME desktop environment.

  1. Log on to your ECS instance by using the management terminal in the ECS console.
  2. Run the following command to update the software repository:
    apt-get update
  3. Run the following commands in sequence to install the GNOME desktop environment:
    apt-get install x-window-system-core
    apt-get install gnome-core
  4. Run the startx command to start the graphical desktop.
  5. Log on to the instance again through the management terminal and confirm that the graphical desktop is running successfully.

FAQ

After a graphical desktop is installed, the following common issues may occur on ECS instances. This section describes the symptoms, analysis, and solutions for these issues.

The keyboard and mouse are not available for CentOS systems after installing the graphical desktop.

Issue

After the desktop environment is installed, connect to the ECS instance by using the management terminal in the ECS console. But you cannot use the mouse and keyboard.

Analytics

This problem may be caused by an exception in keyboard and mouse drivers.

Fixes

Follow these steps to change the driver to evdev.

  1. Run the following command to install the evdev program:
    yum install xorg-x11-drv-evdev
  2. Run the following command to create the configuration file /etc/X11/xorg.conf.
    Xorg -configure
  3. Run the following command to copy the X11 configuration file:
    cp xorg.conf.new /etc/X11/xorg.conf
  4. Modify the mouse and keyboard drivers in the /etc/x11/xorg.conf configuration file to evdev based on the following content.
    Identifier "Keyboard0"
    Driver "evdev"# Change to evdev.
    Option "Device" "/dev/input/event3"
    EndSection
    Section "InputDevice"
    Identifier "Mouse0"
    Driver "evdev"# Change to evdev.
    Option "Device" "/dev/input/event5"
    Option "Mode" "Absolute"
    EndSection
    The configuration file before modification is similar to the following.

    The modified configuration file is as follows:

  5. Restart the ECS instance and check whether the mouse and keyboard can be used properly.

The messagebus and haldaemon services are not started in the CentOS system, causing a failure to use GNOME.

Issue

After the GNOME desktop environment is installed and the system is restarted, you cannot log on to the system. However, after you enter the account and password, the following error message is displayed.

"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."
Analytics

This may be caused by the messagebus and haldaemon services not starting automatically in the desktop environment. To improve system performance and stability, the messagebus and haldaemon services are not automatically started by default in public images from the official Linux website.

Fixes

You can perform the following steps to resolve the issue:

  1. You can use snapshots to roll back a system. For more information, see rollback.
  2. Reinstall the desktop environment.
  3. Run the following command to enable messagebus and haldaemon to start automatically:
    chkconfig --level 35 messagebus on
    chkconfig --level 35 haldaemon on
    Note: to be safe, it is recommended that you modify the startup Level to "Level 3" and then start the desktop environment through the startx command to test the availability of the desktop environment. When an error occurs, you can switch to the terminal mode for troubleshooting. Finally, after ensuring that the desktop environment starts correctly, change the startup Level to "Level 5".

Application scope

  • Elastic Compute Service