Skip to content

XNAT Installation

dbeasley1 edited this page Jun 10, 2026 · 10 revisions

Overview:

The xnat-setup scripts installs all the necessary software and file structures required for an XNAT server. This installs a complete XNAT server within a Docker service. A docker container is similar to a Virtual Machine, therefore it does not affect the host computer and agnostic to the operating system of the host computer.

An overview of software installed and the file structure can be found here

Requirements:

  • OS: Linux. Mac is possible using Docker with some adjustments. Windows with WSL might be possible although completely untested.
  • Docker Engine - Docker Installation Instructions. Not Docker Desktop.

Definitions:

XNAT: an extensible open-source imaging informatics software platform dedicated to imaging-based research. XNAT is a Tomcat web application with a Postgresql database backend. Users interact with XNAT via a web user interface.

Docker: Docker is a technology that enables software and servers to be packaged into lightweight virtual machines - the software, operating system and dependencies are packaged into 'images' and these images can be run in 'containers'.

Important notes - Firewall Configuration:

Follow the guide to install UFW on the host server and configure the firewall.

More on firewalls, firewall configuration and mapping ports on Docker can be found here

Some important developer notes...

For LDAP and network storage, configure post-install.

Installation

Assuming you have a debian (ubuntu) based OS:

Install required/desirable software:

sudo apt-get update
# Install requirements
sudo apt install mc dos2unix

Install docker:

Follow this guide

Retrieve the xnat-setup script:

git clone https://github.com/KCL-BMEIS/xnat-setup.git
cd xnat-setup

Place optional plugins in /plugins folder

The most common plugins are configured in xnat.cfg configuration file and downloaded during installation - you do not have to manually download unless an error message appears during installation. However, any plugins not available via the xnat.cfg file need to be placed in the plugins folder. Plugins can also easily be installed once XNAT is installed.

Copy your SSL certificates into the /cert folder.

For a secure webserver, you must have SSL certificates. These must be placed in the /certs folder and the names inserted into the xnat.cfg file.

For testing (optional), self-signed SSL certificates can be generated using the script:

cd certs
./make_selfsigned_certs.sh [url (minus https//)] [IP]

for example:

./make_selfsigned_certs.sh somewhere.kcl.ac.uk 10.10.10.10

Copy logo into scripts folder:

If you want to install a logo in .png format, name it logo.png and place in the /scripts folder.

Configure Firewall:

Only if you need to configure the firewall yourself (in most cases your IT team will manage this) - read this to configure your firewall.

Optimise and Fill in the Configuration file, xnat.cfg:

Follow the user guide.

Installing behind a Proxy

If you are installing behind a proxy, you will need to complete some additional steps.

Follow the guide here

Build the XNAT Server:

cd Linux
sudo ./build.sh

If any plugins could not be automatically downloaded (links can change and so might be out of date), warning messages will appear below:

################### Warning messages:

XNAT will be ready and accessible on a web-browser when you see:

Starting import script. XNAT is ready to use

A directory /xnat-data containing the archive, database and log files is created, as described in the XNAT Setup Overview

Adding External Storage:

If you are using external storage to store your images, use the default settings for xnat_data (/xnat-data) and then follow the steps in maintenance page to add external storage to the mount points.

LDAP:

Instructions can be found in /path/to/xnat-setup/Linux/ldap. Confgure the file:

ldap-provider.properties

Run:

./build_ldap_images.sh

Follow the instructions printed out, edit docker-compose.yml and restart XNAT.

Configure XNAT post-install:

You must take steps to finish configuring the various components of XNAT when you log in. Please read the post-install instructions.

Installing on a Mac or Windows:

The docker_setup script works on macOS, however you must remove any volumes from the docker-compose files beforehand. This is because of some macOS folder permissions error, preventing the folder being mounted (shared between the Host computer and the Docker container). This is NOT guaranteed to work.

The script may work under Windows using WSL. Again, this has NOT been tested. Do not use Docker Desktop.

Clone this wiki locally