To install Nexus artifact repository as a service, proceed as follows:
As root, copy Artifact-Repository-Nexus-VA.B.C.D.E/nexus-A.B.C-D/bin/nexus to /etc/init.d.
Make the nexus script executable by running the following command:
# chmod 755 /etc/init.d/nexus
Edit the nexus script by changing the following values:
Change NEXUS_HOME to the absolute folder location, for example NEXUS_HOME="usr/local/nexus".
Set the RUN_AS_USER option to a user with restricted rights that you want to use to run the service. Note that you should not be running Nexus as root.
Change PIDDIR to a directory where the user has read/write permissions, for example ./.
Change the owner and group of your Nexus-related directories to the user that you want to use to run the service.
From the commandline, browse to /etc/init.d.
On Ubuntu, install the service by running the following command:
# update-rc.d nexus defaults
On other Linux distributions, use the following commands:
$ chkconfig --add nexus $ chkconfig --levels 345 nexus on