Installation and deployment is shown in short below (for Linux and MacOS system) and in more detail in the Install & Deployment chapter. The deployment via apache2 and mod-wsgi is tested for debian-based Linux systems. A guide for windows installation (tested only for conda) and deployment can be found here.

Quick installation

To deploy the MDsrv, just follow these 8 steps (for debian-based Linux systems).

  1. Install MDsrv
    • via PyPi:
      pip install mdsrv
    • via conda:
      conda config --add channels conda-forge
      conda install -c ngl mdsrv
    • dependencies (included in the installation): mdtraj (incl. cython, numpy, scipy), setuptools, flask
  2. Test your installation:

    To test your installation, execute mdsrv path/to/structure-file path/to/trajectory in your terminal. A new browser window will open. If nothing is shown, please just reload the website. Don't forget to play your trajectory.

    If the executable 'mdsrv' cannot be found, you probably have to adjust your PATH variable, e.g.: export PATH=$PATH:~/.local/bin

    There are three ways of installing, as root (sudo), as 'normal' user or within an virtual environment. Note that the installations paths will differ. When installing as 'normal' user the path will be (under Linux) '/home/USER/.local/lib/python3.8/site-packages ' while as root the installation will be under e.g. '/usr/lib/python3.8/'. You have to adjust the variable 'python-path' in the apache2 config (/etc/apache2/sites-available/000-default.conf) accordingly.

  3. Install Apache2 and mod-wsgi:

    sudo apt-get install apache2 libapache2-mod-wsgi

    If you're using python3, please install

    sudo apt-get install apache2 libapache2-mod-wsgi-py3

    Then activate wsgi with a2enmod wsgi
  4. Add the content of apache.config into /etc/apache2/sites-available/000-default.conf or replace this file.
    Important: Adjust the user and group according to your environment settings and set the python-path or remove it. An example for user and group would be your system name, found on Linux with whoami. Make sure to use absolut paths. For more information, please check the more detailed documentation.

  5. Copy mdsrv.html into the folder /var/www/html/. Make sure the right rights are set (chmod +r /var/www/html/mdsrv.html).

  6. Save and adjust the configuration file app.cfg. The content and setting is explained here.

  7. Place mdsrv.wsgi into /var/www/mdsrv/mdsrv.wsgi. Add the path of the configuration file (app.cfg) into the mdsrv.wsgi file including the name of the file (APP_CFG = '/home/username/important/app.cfg').

  8. Restart the apache server (additional to whenever the app.cfg file is changed):

    sudo service apache2 restart
  9. Access the MDsrv/NGL GUI including your simulations via:


Additional dependencies: You can speed up your trajectories by installing MDAnalysis (Please be aware that this package is large). MDsrv will automaticially detect when MDAnalysis is present and will use it prior to mdtraj. For installation instructions please see the MDAnalysis website.

Operating systems

The MDsrv has been tested and can be installed on Linux, Mac OS and Windows. Deployment is excessively tested for Debian-based Linux systems.

The deployed NGL sessions can be viewed on every operating system and browser which supports WebGL.

Toy example to test your installation & deployment

Find here a quick guide to setup your first mdsrv session:

  1. Go to
  2. Download script.ngl, md_1u19.gro, md_1u19.xtc into e.g. ~/example/

  3. In app.cfg, add the path where script.ngl is located, e.g.:

  4. DATA_DIRS={
    "mytest" : os.path.abspath( "/home/USER/example/"),

  5. In script.ngl you have to change the basePath variable, e.g.:
  6. var basePath = "mytest/"

  7. Restart apache2: service apache2 restart

  8. In your browser call URL: http://localhost/mdsrv.html?load=file://mytest/script.ngl

Troubles? Get information how to do this, inspect the deployment guide.


If you have any questions, found some bugs, or want to report enhancement requests use the Issue Tracker, use the contact formular or write a mail to or

Please give us feedback!