This article describes how to install the graphical desktop environment on Linux instances.
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.
- 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.
For information about the CentOS 8 system, see CentOS 8 installation Gui.
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
- Establish a remote connection and log on to the Linux instance.
- Run the following commands in sequence to install the MATE desktop environment.
yum groups install "X Window System"
yum groups install "MATE Desktop"
- Run the following command. By default, the system uses the graphical desktop environment.
systemctl set-default graphical.target
- Run the
rebootcommand to restart the ECS instance. Alternatively, you can restart an instance in the ECS console.
- Connect to the ECS instance through the management terminal in the ECS console and confirm that the desktop environment is successfully installed.
In this example, install GNOME desktop environment.
- Log on to your ECS instance by using the management terminal in the ECS console.
- Run the following command to update the software repository:
- Run the following commands in sequence to install the GNOME desktop environment:
apt-get install x-window-system-core
apt-get install gnome-core
- Run the
startxcommand to start the graphical desktop.
- Log on to the instance again through the management terminal and confirm that the graphical desktop is running successfully.
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.
- The messagebus and haldaemon services are not started in the CentOS system, causing a failure to use GNOME.
The keyboard and mouse are not available for CentOS systems after installing the graphical desktop.
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.
This problem may be caused by an exception in keyboard and mouse drivers.
Follow these steps to change the driver to evdev.
- Run the following command to install the evdev program:
yum install xorg-x11-drv-evdev
- Run the following command to create the configuration file
- Run the following command to copy the X11 configuration file:
cp xorg.conf.new /etc/X11/xorg.conf
- Modify the mouse and keyboard drivers in the
/etc/x11/xorg.confconfiguration file to evdev based on the following content.
Identifier "Keyboard0"The configuration file before modification is similar to the following.
Driver "evdev"# Change to evdev.
Option "Device" "/dev/input/event3"
Driver "evdev"# Change to evdev.
Option "Device" "/dev/input/event5"
Option "Mode" "Absolute"
The modified configuration file is as follows:
- 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.
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."
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.
You can perform the following steps to resolve the issue:
- You can use snapshots to roll back a system. For more information, see rollback.
- Reinstall the desktop environment.
- 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
startxcommand 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".
- Elastic Compute Service