This topic describes how to install a GRID driver and build a desktop environment on a Linux instance with GPU capabilities.

Prerequisites

  • An Internet-facing instance with GPU capabilities is created. For more information, see Create a compute optimized instance with GPU capabilities.

    We recommend that you select an image from Public Image when you create an instance. If you select an image pre-installed with the NVIDIA driver from Marketplace Image, you must disable the nouveau driver after you create the instance.

    nouveau is an open source driver and it must be disabled before you can install another driver. You can create a nouveau.conf file under the /etc/modprobe.d directory and write blacklist nouveau to the file to disable nouveau.

  • A VNC application is installed. VNC Viewer is used in this example.
  • An NVIDIA GRID license is obtained. To obtain a license, you can choose one of the following methods:
    • Submit a ticket to obtain a temporary license for trial. You do not need to build a license server to use this method.
      Note You can submit a ticket to obtain a temporary license for trial only when you use vgn6i or vgn5i instances.
    • Purchase a license from NVIDIA. You must build a license server to use this method. You can purchase an ECS instance and build a license server by following the tutorial on the official website of NVIDIA.

Background information

You must install an NVIDIA GRID driver if your instance with GPU capabilities requires Open Graphics Library (OpenGL). By default, the NVIDIA GRID license that is granted to NVIDIA GPUs such as P100, P4, and V100 is not activated. You can activate the license by using a trial license to use OpenGL.
Note Only NVIDIA partners can download the driver from the NVIDIA official website. This topic describes how to obtain the NVIDIA GRID driver package from Alibaba Cloud.

Procedure

Install a GRID driver in Ubuntu 16.04 64-bit

  1. Connect to the Linux instance. For more information, see Connect to a Linux instance by using a username and password.
  2. Run the following commands in sequence to upgrade the system and install KDE:
    apt-get update
    apt-get upgrade
    apt-get install kubuntu-desktop
  3. Run the reboot command to restart the system.
  4. Connect to the Linux instance again. Run the following commands to download and decompress the NVIDIA GRID driver package.
    The NVIDIA GRID driver package contains the drivers for various operating systems. For Linux, select NVIDIA-Linux-x86_64-410.39-grid.run.
    wget http://nvdia-driver-410.oss-cn-shenzhen.aliyuncs.com/NVIDIA-Linux-x86_64-410.39-grid.run                    
  5. Run the following commands in sequence and follow the prompts to install the NVIDIA GRID driver:
    chmod 777 NVIDIA-Linux-x86_64-410.39-grid.run
    . /NVIDIA-Linux-x86_64-410.39-grid.run
  6. Run the nvidia-smi command to verify the installation.
    If a command output similar to the following one is displayed, the driver is installed.
  7. Add a license server to activate the license.
    1. Run the cd /etc/nvidia command to switch to the /etc/nvidia directory.
    2. Run the cp gridd.conf.template gridd.conf command to create a file named gridd.conf.
    3. Add license server information to the gridd.conf file.
      ServerAddress=<IP address of the license server>
      ServerPort=<Port of the license server (Default port: 7070)>
      FeatureType=2
      EnableUI=TRUE
  8. Run the following command to install x11vnc:
    apt-get install x11vnc
  9. Run the lspci | grep NVIDIA command to query the GPU BusID.

    In this example, the GPU BusID is 00:07.0.

  10. Configure the X Server environment and restart the system.
    1. Run the nvidia-xconfig --enable-all-gpus --separate-x-screens command.
    2. Edit /etc/X11/xorg.conf by adding your GPU BusID to Section "Device". In this example, BusID "PCI:0:7:0" is added.
    3. Run the reboot command to restart the system.

Test the GRID driver in Ubuntu 16.04 64-bit

  1. Run the following command to install the GLX application:
    apt-get install mesa-utils                    
  2. Run the startx command to start X Server.
    • If the startx command is unavailable, run the apt-get install xinit command to install the GLX application.
    • Running the startx command may result in the hostname: Name or service not known error. This error does not affect the startup of X Server. You can run the hostname command to obtain the host name of the instance, and modify the /etc/hosts file by replacing the hostname that follows 127.0.0.1 with the actual host name of your instance.
  3. Start a new terminal session of the SSH client and run the following command to start x11vnc:
    x11vnc -display :1
    If a command output similar to the following one is displayed, x11vnc is started. In this case, you can connect to the instance by using a VNC application. In this example, VNC Viewer is used.
  4. Log on to the ECS console and add security group rules to the security group to which the instance belongs, to allow inbound traffic on TCP port 5900. For more information, see Add security group rules.
  5. On the local machine, start VNC Viewer and enter <Public IP address of the instance>:5900 to connect to the instance and go to the KDE desktop.
  6. Run the glxinfo command to view the configurations supported by the current GRID driver:
    1. Start a new terminal session of the SSH client.
    2. Run the export DISPLAY=:1 command.
    3. Run the glxinfo -t command to list the configurations supported by the current GRID driver.
  7. Run the glxgears command to test the GRID driver:
    1. On the KDE desktop, right-click the desktop and then select Run Command.
    2. Run the glxgears command to start the testing application.
      If a window similar to the following one is displayed, the GRID functions properly.

Install a GRID driver in CentOS 7.3 64-bit

  1. Connect to the Linux instance. For more information, see Connect to a Linux instance by using a username and password.
  2. Run the following commands in sequence to upgrade the system and install KDE:
    yum update
    yum install kernel-devel
    yum groupinstall "KDE Plasma Workspaces"                    
  3. Run the reboot command to restart the system.
  4. Connect to the Linux instance again. Run the following command to download and decompress the NVIDIA GRID driver package.

    The NVIDIA GRID driver package contains the drivers for various operating systems. For Linux, select NVIDIA-Linux-x86_64-410.39-grid.run.

    wget http://nvdia-driver-410.oss-cn-shenzhen.aliyuncs.com/NVIDIA-Linux-x86_64-410.39-grid.run                    
  5. Disable the nouveau driver.
    1. Run the vim /etc/modprobe.d/blacklist.conf command and add blacklist nouveau to the file.
    2. Run the vim /lib/modprobe.d/dist-blacklist.conf command and add the following content:
      blacklist nouveau
      options nouveau modeset=0                            
    3. Run the mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img command.
    4. Run the dracut /boot/initramfs-$(uname -r).img $(uname -r) command.
  6. Run the reboot command to restart the system.
  7. Run the following commands in sequence and follow the prompts to install the NVIDIA GRID driver:
    chmod 777 NVIDIA-Linux-x86_64-410.39-grid.run
    . /NVIDIA-Linux-x86_64-410.39-grid.run
  8. Run the nvidia-smi command to verify the installation.
    If a command output similar to the following one is displayed, the driver is installed.
  9. Add a license server to activate the license.
    1. Run the cd /etc/nvidia command to switch to the /etc/nvidia directory.
    2. Run the cp gridd.conf.template gridd.conf command to create a file named gridd.conf.
    3. Add license server information to the gridd.conf file.
      ServerAddress=<IP address of the license server>
      ServerPort=<Port of the license server (Default port: 7070)>
      FeatureType=2
      EnableUI=TRUE
  10. Run the following command to install x11vnc:
    yum install x11vnc                    
  11. Run the lspci | grep NVIDIA command to query the GPU BusID.
    In this example, the GPU BusID is 00:07. 0.
  12. Configure the X Server environment.
    1. Run the nvidia-xconfig --enable-all-gpus --separate-x-screens command.
    2. Edit /etc/X11/xorg.conf by adding your GPU BusID to Section "Device". In this example, BusID "PCI:0:7:0" is added.
  13. Run the reboot command to restart the system.

Test the GRID driver in CentOS 7.3 64-bit

  1. Run the startx command to start X Server.
  2. Start a new terminal session of the SSH client and run the following command to start x11vnc:
    x11vnc -display :0
    If a command output similar to the following one is displayed, x11vnc is started. In this case, you can connect to the instance by using a VNC application. In this example, VNC Viewer is used.
  3. Log on to the ECS console and add security group rules to the security group to which the instance belongs, to allow inbound traffic on TCP port 5900. For more information, see Add security group rules.
  4. On the local machine, start VNC Viewer and enter <Public IP address of the instance>:5900 to connect to the instance and go to the KDE desktop.
  5. Run the glxinfo command to view the configurations supported by the current GRID driver.
    1. Start a new terminal session of the SSH client.
    2. Run the export DISPLAY=:0 command.
    3. Run the glxinfo -t command to list the configurations supported by the current GRID driver.
  6. Run the glxgears command to test the GRID driver.
    1. On the KDE desktop, right-click the desktop and then select Run Command.
    2. Run the glxgears command to start the testing application.
      If a window similar to the following one is displayed, the GRID functions properly.