Attention: Confluence is not suitable for the storage of highly confidential data. Please ensure that any data classified as Highly Protected is stored using a more secure platform.
If you have any questions, please refer to the University's data classification guide or contact ict.askcyber@sydney.edu.au

Configure XNAT Gateway as a Service

After successfully installing XNAT-DICOM Gateway, the next step is setting up XNAT Gateway as a Linux Service. 

In this example, XNAT-DICOM Gateway will be executed in RHEL7 version by root user, and the working directory will be at /srv/XNATGW2019. Also if the user is logging on via Mac, use 

Mac SSH
$ ssh -XY unikey_admin@xnatpg00027.srv.sydney.edu.au

For Windows please refer to below article to set up PuTTY to securely run graphical applications hosted on a remote Linux server using Xming.

Remote Graphical Applications over SSHPermalink


## install java and wget

sudo yum install -y java-1.8.0-openjdk.x86_64 wget unzip

## install X11

sudo yum install -y xorg-x11-xauth.x86_64 xorg-x11-server-utils.x86_64
## Download the XNATDICOMGateway to the /srv folder. Some of the University of Sydney SDDC VM do not allow outbound traffic to external ftp servers. In that case, please download the the file using a web browser first 
## then move the file using for example WinSCP
##Create folder for the gateway software
sudo mkdir -p /srv/XNATGW2019
sudo chown -R yourusername:yourusergroup /srv/XNATGW2019 
##Create folder for the images
[root@xnatpg00027 XNATGW2019]# mkdir -p /srv/XNATGW2019/images
[root@xnatpg00027 XNATGW2019]# chmod -R 2775 /srv/XNATGW2019/images
curl -L -o /srv/XNAT_Gateway_Linux_Mar2019.zip ftp://ftp.nrg.wustl.edu/pub/xnd/download/gw/XNAT_Gateway_Linux_Mar2019.zip
unzip /srv/XNAT_Gateway_Linux_Mar2019.zip
## Run the GUI in the folder
cd /srv/XNATGW2019
##Command
java -jar dist/gatewaye.jar


Step 1. Use GUI to configure the username/password for XNAT Gateway

Gateway Settings

AE Title: XNATPRODGW

Port: 25050

Tick on "Allow C_GET Retrieve From Anonymous Remote AEs"

Default XNAT Server:

Name: XNATProduction

Hostname: https://xnat.sydney.edu.au

Username: sydimaging_hybridtheatre

password: *

NameARTISPHENO_HT
AE TitleARTIS164010
Hostname10.20.11.48
Port104

ClearCanvas properties for connecting to the gateway


Step 2. the xnat configuration file will be saved in ~/.xnatgateway folder

Step 3. Copy this folder to /root

[root@XXX]sudo cp -R /home/USER/.xnatgateway /root/

Step 4. Create a file /usr/lib/systemd/system/xnatgateway.service (as root)

Content below:

[Unit]
Description=XNAT DICOM Gateway

[Service]
WorkingDirectory=/srv/XNATGW2019
ExecStart=/bin/java -Xms512m -Xmx6g -cp "./dist/gatewaye.jar:./dist/lib/commons-codec-1.3.jar:./dist/lib/commons-httpclient-3.1.jar:./dist/lib/commons-io-1.4.jar:./dist/lib/commons-lang-2.4.jar:./dist/lib/commons-logging-1.1.1.jar:./dist/lib/dcm4che.jar:/lib/dcm4che-audit-2.0.21.jar:./dist/lib/dom4j-1.6.1.jar:./dist/lib/jai_imageio_api.jar:./dist/lib/log4j-1.2.15.jar:./dist/lib/xdat-beans-1.0.jar:./dist/lib/xnd-beans.jar" org.nrg.xnat.gateway.XNATGatewayServer c
User=root
Type=simple
RestartSec=10

[Install]
WantedBy=multi-user.target

(1) The XNAT Gateway files will be extracted to /srv/XNATGW2019

(2) -Xms 512m means the program starts with 512MB RAM.

(3) -Xmx 6g means the program maximum will use 6GB RAM

Step 5. Create a soft link in the /etc/systemd/system/multi-user.target.wants/xnatgateway.service

[root@XXX]# ln -s  /usr/lib/systemd/system/xnatgateway.service /etc/systemd/system/multi-user.target.wants/xnatgateway.service
[root@XXX]# ls -ltr /etc/systemd/system/multi-user.target.wants/ |grep xnat
lrwxrwxrwx. 1 root root 43 Mar 19 22:37 xnatgateway.service -> /usr/lib/systemd/system/xnatgateway.service


Step 6. Run the below command to reload and start the service

[user@] sudo systemctl daemon-reload
[user@] sudo systemctl start xnatgateway
[user@] sudo systemctl enable xnatgateway
If stopping service or checking status of service:
[user@] sudo systemctl stop xnatgateway
[user@] sudo systemctl status xnatgateway


2.1 Checking the XNAT DICOM Gateway Services

[root@XXX]# systemctl status xnatgateway
● xnatgateway.service - XNAT DICOM Gateway
   Loaded: loaded (/usr/lib/systemd/system/xnatgateway.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-03-19 22:38:06 AEDT; 4min 36s ago
 Main PID: 2848 (java)
   CGroup: /system.slice/xnatgateway.service
           └─2848 /bin/java -Xms128m -Xmx2g -cp ./dist/gatewaye.jar:./dist/lib/commons-co...

Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal systemd[1]: xnatgateway.s...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal systemd[1]: Unit xnatgate...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal systemd[1]: xnatgateway.s...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal systemd[1]: Started XNAT ...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal systemd[1]: Starting XNAT...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal java[2848]: GatewayEnviro...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal java[2848]: Unrestricted ...
Mar 19 22:38:06 ip-10-86-15-216.ap-southeast-2.compute.internal java[2848]: Server started
Hint: Some lines were ellipsized, use -l to show in full.