Skip to main content

Run IQ Server as a Service

Run IQ Server as a systemd service on Linux so it starts when the host boots. This procedure uses the Linux IQ Server distribution with a bundled JDK.

For Windows, see Run IQ Server as a service on Windows Server.

Note

A standalone JAR installation needs a different Java command. The systemd unit below runs the foreground launcher included with the bundled JDK distribution.

  1. Create a dedicated service user with limited access if it does not already exist:

    if ! id -u iqserver >/dev/null 2>&1; then
      sudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin iqserver
    fi
  2. Install the bundled JDK distribution as described in Install self-hosted IQ Server. The steps below assume that /opt/sonatype-iq-server/bin/nexus-iq-server exists. If /opt/sonatype-iq-server/config.yml does not exist, copy the bundled sample configuration:

    if [ ! -f /opt/sonatype-iq-server/config.yml ]; then
      sudo cp /opt/sonatype-iq-server/examples/config.yml /opt/sonatype-iq-server/config.yml
    fi

    Review config.yml before starting the service. If you installed IQ Server in another directory, update the paths in the commands and unit below.

  3. Configure IQ Server as a systemd service in the SystemD section below.

Set directory permissions

The iqserver user needs access to the installation directory and write access to the work and log directories configured in config.yml. For the bundled sample configuration, grant ownership of the installation directory to the service user. Resolve the path so this also works when /opt/sonatype-iq-server is a symbolic link:

sudo chown -R iqserver "$(readlink -f /opt/sonatype-iq-server)"

If sonatypeWork points to a directory outside the installation directory, grant the iqserver user write access to that directory as well.

SystemD

This example runs IQ Server as a native systemd service and does not require an init.d script.

  1. Make sure the iqserver user exists.

  2. Ensure IQ Server and config.yml are installed in /opt/sonatype-iq-server.

  3. Create /etc/systemd/system/sonatypeiq.service.

  4. Add the following unit and save the file:

    [Unit]
    Description=Sonatype IQ Service
    After=network-online.target
    
    [Service]
    Type=simple
    ExecStart=/opt/sonatype-iq-server/bin/nexus-iq-server server config.yml
    WorkingDirectory=/opt/sonatype-iq-server
    User=iqserver
    Restart=on-failure
    SuccessExitStatus=143
    TimeoutSec=600
    
    [Install]
    WantedBy=multi-user.target

Activate the service with these commands:

sudo systemctl daemon-reload
sudo systemctl enable sonatypeiq.service
sudo systemctl start sonatypeiq.service
sudo systemctl status sonatypeiq.service --no-pager

When startup completes, systemctl status should report active (running). Open http://localhost:8070/ on the server, or use its hostname when connecting from another machine.

Native Linux installers from the community

Community-maintained Linux installers can configure IQ Server as a service, but Sonatype does not officially support them.

See github.com/sonatype-nexus-community/nexus-iq-server-installer.