Running IQ Server as a Service

The IQ Server can be run as a service or daemon. This ensures that IQ server will restart when the operating system reboots. 

Running IQ Server as a service is highly recommended for production instances. 

We recommend creating a dedicated user for the IQ Server Service. This user should have limited access. 


The user needs full access rights to the IQ Server installation directory and the sonatypeWork directory listed in your config.yml. By default the sonatype work directory is inside the nexus-iq-server folder. The following command can grant a service user permission:

chown -Rv {username} /opt/nexus-iq-server

The command for starting IQ Server can be used in a startup script. Adjust the javaopts variable to suit the hardware used.

#! /bin/sh
cd /opt/nexus-iq-server
javaopts="-Xmx4096m -XX:MaxPermSize=128m"
java $javaopts -jar nexus-iq-server-*.jar server config.yml 2> stderr.log
A running server can be stopped with a simple shutdown script in Shutdown script.
     pid=`ps aux | grep nexus-iq-server | grep -vE '(stop|grep)' | awk '{print $2}'`
     kill $pid

Typically these approaches are combined to a service script similar to the script listed in Simplistic Service Script for Unix Systems. Saving this script as e.g. nexus-iq-server lets you to start the server with its log running to the current shell with:

./nexus-iq-server console

To start IQ Server as a background process:

./nexus-iq-server start

To stop running IQ Server as a background process: 

./nexus-iq-server stop

This example script can be improved to be more robust against repeat invocations, long running stops, and potentially work better across different Unix flavors, but shows the principal functionality. A similar script can be used for Windows:


# The following comment lines are used by the init setup script like the
# chkconfig command for RedHat based distributions. Change as
# appropriate for your installation.

# Provides:          nexus-iq-server
# Required-Start:    $local_fs $remote_fs $network $time $named
# Required-Stop:     $local_fs $remote_fs $network $time $named
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: nexus-iq-server service
# Description:       Start the nexus-iq-server service

JAVA_OPTIONS="-Xmx4096m -XX:+UseG1GC"
# The user ID which should be used to run the IQ Server
# IMPORTANT - Make sure that the user has the required privileges to write into the IQ Server work directory.

    _cmd &
    echo "Started nexus-iq-server"


    pid=`ps aux | grep nexus-iq-server | grep '.jar server' | grep -vE '(stop|grep)' | awk '{print $2}'`
    kill $pid
    echo "Stopping nexus-iq-server - PID $pid ($?)"

    echo "Usage: nexus-iq-server [console|start|stop]"

    cd $NEXUS_IQ_SERVER_HOME || return $?
    chown $RUN_AS_USER ./stderr.log
    if [ "$RUN_AS_USER" == "$USER" ]; then
        java $JAVA_OPTIONS -jar nexus-iq-server-$VERSION.jar server config.yml
        sudo -u $RUN_AS_USER java $JAVA_OPTIONS -jar nexus-iq-server-$VERSION.jar server config.yml
    fi 2> stderr.log

case $1 in

Setting the above as a startup script will vary between operating systems and distributions depending on the init system used. Generally the script would be copied to a dedicated startup directory and assigned with run-levels and other characteristics for the start up. The following commands show an example on a Debian-based system:

sudo su
cp nexus-iq-server /etc/init.d/
cd /etc/init.d
update-rc.d nexus-iq-server defaults
service nexus-iq-server start

Depending on the requirements from your system administrator, modify the scripts to fit into your environment and exact deployment scenario.


This example is a script that uses systemd to run the IQ Server as "iqserver" user. First make sure the necessary user exists. Then create the nexus-iq-server script in /etc/init.d as described above. Then create a file called nexusiq.service. Add the following contents, and save the file in the /etc/systemd/system/ directory:

Description=Nexus IQ Service

ExecStart=/etc/init.d/nexus-iq-server start
ExecStop=/etc/init.d/nexus-iq-server stop


Activate the service with the following commands:

chmod a+x /etc/init.d/nexus-iq-server
sudo systemctl daemon-reload
sudo systemctl enable nexusiq.service
sudo systemctl start nexusiq.service

Native Linux Installers from the community

There are community provided native installers for linux available here: nexus-iq-server-installer

These installers setup IQ Server to run as a service. NOTE: These are provided by the community, and not officially supported.