Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Elastic Cloud Server/ FAQs/ OS/ How Can I Install a GUI on an ECS Running Ubuntu?

How Can I Install a GUI on an ECS Running Ubuntu?

Updated on 2025-01-10 GMT+08:00

Scenarios

To provide a pure system, the ECSs running Ubuntu do not have a GUI installed by default. You can install a GUI on such ECSs as needed.

For GPU-accelerated ECSs, after installing a GUI, you need to configure X Server, x11vnc, and lightdm to make sure that:

  • The graphics system and VNC server are automatically started upon the ECS startup.
  • Applications can invoke GPUs properly after a remote login using VNC.

You can perform the following steps to install a GUI on an Ubuntu ECS:

Constraints

  • This document applies to ECSs running Ubuntu 16.04, 18.04, and 20.04.
  • The Ubuntu ECS must have an EIP bound or have an intranet image source configured.
  • Before installing a GUI on an ECS, ensure that the memory is no less than 2 GB to prevent GUI installation or ECS startup failures.
  • If the ECS is Kunpeng-powered, use the image source provided by Huawei Cloud. For details, see How Can I Use an Automated Tool to Configure a Huawei Cloud Image Source (x86_64 and Kunpeng)?
  • GPU-accelerated ECSs must have a correct GPU driver installed. For details, see GPU Driver.

Installing a GUI

  1. Log in to the ECS and install a GUI desktop environment.
    1. Run the following command to update the software library:

      apt-get update

    2. Run the following command to install the Ubuntu GUI desktop component:
      • For Ubuntu 16.04, run the following command:

        apt-get install -y scite xorg xubuntu-desktop

      • For Ubuntu 18.04 and 20.04, run the following command:

        apt-get install -y ubuntu-desktop

  2. Run the following command to edit the root/.profile file:

    vim /root/.profile

    Press i to enter the editing mode and change mesg n || true in the last line to tty -s && mesg n || true. After the modification, the file content is as follows:

    # ~/.profile: executed by Bourne-compatible login shells.
     
    if [ "$BASH" ]; then
      if [ -f ~/.bashrc ]; then
        . ~/.bashrc
      fi
    fi
    tty -s && mesg n || true
  3. Press Esc to exit editing mode.
  4. Run the following command to save and exit the configuration file:

    :wq

  5. (Mandatory for Ubuntu 20.04) Add a member account.

    After the GUI desktop component is installed on the ECS, you cannot log in to the Ubuntu 20.04 OS as user root. You need to add a member account for logging in to the GUI desktop.

    Run the following command to add user user01:

    adduser user01

    Set a password for user01 as prompted.

    Adding user `user01' ...
    Adding new group `user01' (1001) ...
    Adding new user `user01' (1001) with group `user01' ...
    Creating home directory `/home/user01' ...
    Copying files from `/etc/skel' ...
    New password: 
    Retype new password: 
    passwd: password updated successfully

    Set information about user01. You can press Enter to skip the setting. Then the system prompts you to check whether the entered information is correct.

    Enter Y.

    Changing the user information for user01
    Enter the new value, or press ENTER for the default
            Full Name []: 
            Room Number []: 
            Work Phone []: 
            Home Phone []: 
            Other []: 
    Is the information correct? [Y/n] Y
  6. Run the reboot command to restart the ECS.
  7. Log in to the ECS using VNC provided on the management console and log in to the GUI desktop using the member account created in 5 or the root account.

(Optional) Configuring X Server, x11vnc, and lightdm

For GPU-accelerated ECSs, you need to configure X Server, x11vnc, and lightdm when installing a GUI.

  1. Remotely log in to the ECS.
  2. Query the BusID of the GPU.

    lspci | grep -i nvidia

    Figure 1 GPU's BusID
  3. Generate the X Server configuration.

    nvidia-xconfig --enable-all-gpus --separate-x-screens

  4. Configure the GPU's BusID in "Section Device" in the generated /etc/X11/xorg.conf.
    1. Edit /etc/X11/xorg.conf.

      vi /etc/X11/xorg.conf

    2. Press i to enter editing mode.
    3. Add the GPU's BusID in "Section "Device".
      Figure 2 Adding the GPU's BusID
      NOTE:

      The BusID queried in step 2 is a hexadecimal number. You need to convert it to a decimal number before adding it to "Section Device" in /etc/X11/xorg.conf.

      1. For example, the queried BusID is 00.0d.0 (a hexadecimal number) and needs to be converted to PCI:00:13:0 (a decimal number).
    4. Press Esc to exit editing mode.
    5. Run the following command to save and exit the configuration file:

      :wq

  5. Install x11vnc.

    apt-get -y install x11vnc

  6. Install lightdm.

    apt-get -y install lightdm

  7. Select lightdm as the default display manager.
    Figure 3 Selecting a display manager
  8. Configure the GUI desktop environment to automatically start upon ECS startup.

    systemctl set-default graphical.target

  9. (Optional) Configure the x11vnc to automatically start upon ECS startup.
    1. Add the /lib/systemd/system/myservice.service file.

      vi /lib/systemd/system/myservice.service

    2. Press i to enter editing mode.
    3. Add the following content to the file:
      [Unit]
      Description=My Service
      After=network.target lightdm.service
      
      [Service]
      Type=oneshot
      ExecStart=/usr/bin/x11vnc -forever -loop -noxdamage -repeat -rfbport 5902 -shared -bg -auth guess -o /var/log/vnc.log
      
      [Install]
      WantedBy=multi-user.target
      Alias=myservice.service
    4. Press Esc to exit editing mode.
    5. Run the following command to save and exit the configuration file:

      :wq

  10. Load configuration files.

    systemctl daemon-reload

    systemctl enable myservice.service

  11. Run the reboot command to restart the ECS.

(Optional) Verifying Drivers on GPU-accelerated ECSs

After installing a GUI on a GPU-accelerated ECS, perform the following operations to check whether the driver is working properly:

  1. Log in to the management console.
  2. Configure a security group for the ECS.
    1. On the ECS list, click the name of an ECS for which you want to configure the security group rule. On the ECS details page, click Security Groups.
    2. Expand the security group and in the upper right corner of the security group rule list, click Modify Security Group Rule.
    3. On the Inbound Rules page, click Add Rule.
    4. In the Add Inbound Rule dialog box, follow the prompts to add the following security group rule:

      Allow inbound access through TCP port 5902. The port number is determined by the rfbport parameter in step 9.c.

  3. Log in to the ECS using VNC.

    The following uses TightVNC as an example.

    Figure 4 TightVNC client
  4. Right-click on the blank area and choose Open in Terminal from the shortcut menu.
  5. Run the following command on the terminal. If the graphics card information is displayed as follows, the driver is working properly.

    nvidia-settings

    Figure 5 Graphics card information
    NOTE:

    If a GPU-accelerated ECS has a GRID driver installed, you need to configure a license to use the GPU rendering capability. For details, see Installing a GRID Driver on a GPU-accelerated ECS.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback