Skip to content

Instantly share code, notes, and snippets.

@sterin
Forked from dgoguerra/opengl-ubuntu-ec2-install.md
Created September 14, 2017 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sterin/467edc0452588bc773ce17f31542b0c1 to your computer and use it in GitHub Desktop.
Save sterin/467edc0452588bc773ce17f31542b0c1 to your computer and use it in GitHub Desktop.
Set up OpenGL on a Ubuntu 16.04 g2.2xlarge EC2 machine (following https://stackoverflow.com/q/19856192)

Steps from https://stackoverflow.com/q/19856192 with minor changes to work on Ubuntu 16.04.

# Install the Nvidia driver
sudo apt-add-repository ppa:ubuntu-x-swat/updates
sudo apt-get update
sudo apt-get install nvidia-current

# Driver installation needs reboot
sudo reboot now

After rebooting, install and run X server:

# Install and configure X window with virtual screen
sudo apt-get install xserver-xorg libglu1-mesa-dev freeglut3-dev mesa-common-dev libxmu-dev libxi-dev
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024

Then update /etc/X11/xorg.conf adding BusID "0:3:0" in the Section "Device" section:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GRID K520"
    BusID          "0:3:0"
EndSection

And run the X server:

sudo /usr/bin/X :0 &

OpenGL programs are now workable:

DISPLAY=:0 glxinfo
DISPLAY=:0 glxgears
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment