Prerequisites
A full OpenGL profile requires X to be running. For X to run, it requires a display to be connected to the machine. Given that most server machines do not have this, it becomes difficult to run OpenGL. Google Chrome on Linux will use the GPU if it finds that an external display is attached to the system. This document details how to get OpenGL and X up and running without having a display connected to the server.
Note: This instructions uses a g3s.xlarge (4cpu x 30GB RAM + 1 gpu ) instance on AWS
Get the Machine Ready
Start by installing the necessary packages:
yum install mesa-dri-drivers
yum install -y gcc
yum install kernel-devel-$(uname -r)
yum install glx-utils
yum install libglvnd
yum install libglvnd-glx
yum install xorg-x11-server-Xorg
yum install pkgconfig
yum install libglvnd-devel
OR
$ yum install -y mesa-dri-drivers gcc kernel-devel-$(uname -r) glx-utils libglvnd libglvnd-glx xorg-x11-server-Xorg pkgconfig libglvnd-devel
Download and run the NVIDIA installer:
$ wget 'https://us.download.nvidia.com/tesla/460.32.03/NVIDIA-Linux-x86_64-460.32.03.run
$ sh ./NVIDIA-Linux-x86_64-460.32.03.run
Update Configurations
Update the grub configuration file to blacklist nouveau:
Open /etc/default/grub in an editor.
Amend the GRUB_CMDLINE_LINUX to include this blacklist piece - rdblacklist=nouveau. The update should look like this:
GRUB_CMDLINE_LINUX = "rdblacklist=nouveau"
Re-run GRUB to ensure that the blacklist is in place & reboot the machine:
$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ init 6
Upon boot, confirm that nouveau is not installed:
$ lsmod | grep nouveau
Now run the nvidia-xconfig and remove the xorg file as its not useful.
$ nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
$ rm /etc/X11/xorg.conf
Enable Chrome Switches
Add/Remove the following Chrome switches and update permissions and owner of the file:
$ vi /var/CatchPoint/Agent/Plugins/Chrome/chrome_custom_launch_switches.config
Add/Remove the following switches:
REMOVE --disable-renderer-backgrounding
REMOVE --disable-accelerated-2d-canvas
REMOVE --disable-accelerated-video-decode
REMOVE --disable-d3d11
REMOVE --disable-flash-3d
REMOVE --disable-flash-stage3d
REMOVE --disable-gpu
Update permissions & owner of the file:
$ chmod 0400 /var/CatchPoint/Agent/Plugins/Chrome/chrome_custom_launch_switches.config
$ chown serveruser:cp /var/CatchPoint/Agent/Plugins/Chrome/chrome_custom_launch_switches.config
Start X and restart catchpoint services:
$ /usr/bin/X :0 &
$ catchpoint restart
Summary
Once X has started successfully, run echo $DISPLAY. It is very likely that the output of this will be empty. If you have glewinfo installed, run the following command env DISPLAY=:0 glewinfo | less.
The goal of this command is to run glewinfo having temporarily set DISPLAY to :0 (virtual display on remote system). If this command runs successfully, you should be able to see the graphics card on the remote system along with the full OpenGL profile. And now you are ready to deploy applications using X.
If you want to set DISPLAY for the entire session, run export DISPLAY=:0. To set DISPLAY permanently, add the same line to your bashrc file.
References:
https://gist.github.com/shehzan10/8d36c908af216573a1f0