Skip to content

Instantly share code, notes, and snippets.

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 mgherghi/07b2c2c2aadfc386b72ecb2370db8651 to your computer and use it in GitHub Desktop.
Save mgherghi/07b2c2c2aadfc386b72ecb2370db8651 to your computer and use it in GitHub Desktop.
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding

https://github.com/aancel/admin/wiki/VirtualGL-on-Ubuntu

https://virtualgl.org/About/Introduction

https://www.turbovnc.org

VirtualGL

When you use ssh with X forwarding, you might have noticed that you cannot execute programs that require 3D acceleration. That's where VirtualGL comes into play.

VirtualGL is an open source toolkit that gives any Unix or Linux remote display software the ability to run OpenGL applications with full 3D hardware acceleration.

With VirtualGL, the OpenGL commands and 3D data are instead redirected to a 3D graphics accelerator (AKA "graphics processing unit" or "GPU") in the application server, and only the rendered 3D images are sent to the client machine.

Inititalization

Download the following packages for the server:

Installation

  • Make sure you have installed the proprietary drivers for your graphics card (at least for Nvidia that I have tested this setup).

  • Install virtualgl on Ubuntu, by installing the deb file you already downloaded:

sudo dpkg -i virtualgl_*.deb
  • Shutdown the display manager and configure virtualgl server:
# login as root
# If you are using KDE, install lightdm (sudo apt-get install lightdm)
# otherwise the following configuration steps do not work with SDDM (yet)
service lightdm stop
/opt/VirtualGL/bin/vglserver_config
# Go through the questions until the configuration is done.
sudo reboot

# Sanity check for restricted access to 3D X Server
xauth merge /etc/opt/VirtualGL/vgl_xauth_key
xdpyinfo -display :0
/opt/VirtualGL/bin/glxinfo -display :0 -c
# Check that the Graphic card is indeed used and not Mesa

  • Install TurboVNC:
sudo dpkg -i turbovnc_*.deb

For the TurboVNC clients, you can find them at the same address

Use

  • Launch /opt/TurboVNC/bin/vncserver on the server. Possible options:
    • -otp: enable One Time Password
    • -geometry x: specify size of the window
  • Connect using TurboVNC client (/opt/TurboVNC/bin/vncviewer). (The screen will appear black but X is launched)
  • In a terminal on the server
    • export the DISPLAY variable to the value used by vncserver
    export DISPLAY=:1 # if your vncserver started in DISPLAY :1
    
    • Launch an X App (with vglrun to have 3D acceleration)
    # Example command
    vglrun glxgears
    

Tips

  • To get a window manager up and running (in order to not have the black screen) do the following:

    • With the command vncserver -list find the started vnc server. This command will give you an output that looks like this:
    $ vncserver -list
    
    TurboVNC server sessions:
    
    X DISPLAY #     PROCESS ID
    :1              8972
    
    • Kill the started VNC server with the command vncserver -kill :1. Change the :1 with the X DISPLAY value returned by the vncserver -list command earlier.

    • Make sure that the commands xfce4-panel and xfce4-session exist in your system (if not install them), and append the following line at the end of the file ~/.vnc/xstartup.turbovnc.

    xfce4-session &
    
    • Now start the vncserver again:
    /opt/TurboVNC/bin/vncserver
    
  • Export PATH variables:

export PATH=/opt/TurboVNC/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment