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.
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
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-serverexists. If/opt/sonatype-iq-server/config.ymldoes 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.ymlbefore starting the service. If you installed IQ Server in another directory, update the paths in the commands and unit below.Configure IQ Server as a
systemdservice 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.
Bundled JDK distribution (Recommended)
The bundled distribution includes bin/nexus-iq-server, which starts IQ Server with its bundled JDK. A separate Java installation is not required. For IQ Server 205 and later, a custom script that starts the server JAR directly should reference the JAR in the jars directory.
The distribution also includes a sample configuration file and example service scripts in the examples directory.
SystemD
This example runs IQ Server as a native systemd service and does not require an init.d script.
Make sure the
iqserveruser exists.Ensure IQ Server and
config.ymlare installed in/opt/sonatype-iq-server.Create
/etc/systemd/system/sonatypeiq.service.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.