弹性云服务器 ECS-Ubuntu系列弹性云服务器如何安装图形化界面?:安装图形化界面

时间:2024-05-23 17:23:52

安装图形化界面

  1. 登录弹性云服务器,运行如下命令安装图形化界面。
    1. 执行如下命令,更新软件库。

      apt-get update

    2. 执行如下命令,安装Ubuntu图形化桌面。
      • 对于Ubuntu16.04版本,请执行以下命令:

        apt-get install -y scite xorg xubuntu-desktop

      • 对于Ubuntu18.04和20.04版本,请执行以下命令:

        apt-get install -y ubuntu-desktop

  2. 执行以下命令,编辑/root/.profile文件。

    vim /root/.profile

    单击“i”,进入编辑模式,修改末尾行“mesg n || true”为“tty -s && mesg n || true”,修改后该文件内容如下:

    # ~/.profile: executed by Bourne-compatible login shells.
     
    if [ "$BASH" ]; then
      if [ -f ~/.bashrc ]; then
        . ~/.bashrc
      fi
    fi
    tty -s && mesg n || true
  3. 单击“Esc”退出编辑模式。
  4. 执行以下命令,保存并退出文件。

    :wq

  5. (Ubuntu 20.04操作系统必选)添加子账号。

    安装图形化桌面后,Ubuntu 20.04操作系统禁止root登录,因此需要在安装完成后添加子账号用于登录图像化桌面。

    以添加user01用户为例,执行以下命令。

    adduser user01

    根据提示设置新用户的密码

    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

    设置user01的其他信息,该信息均为可选,如果不设置可以 按回车键跳过,最后系统将提示您确认输入的信息是否正确无误。

    正确输入"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. 执行reboot命令,重启服务器。
  7. 通过控制台提供的VNC登录方式连接服务器,使用root账号或5中添加的子账号登录图形化界面。
    • Ubuntu 20.04操作系统需使用添加的子账号登录图像化桌面。
    • 对于GPU加速型弹性云服务器弹性云服务器,还需要继续配置X Server、x11vnc和lightdm
support.huaweicloud.com/ecs_faq/ecs_faq_0710.html