Search code examples
nexussonatypenexus3

Nexus3 OSS: Installing Multiple Instances on Windows


This is actually an informational post to show some undocumented abilities of the windows nexus.exe. If anyone wants to provide some other useful information about Nexus3 OSS installation and/or configuration on Windows that is not readily available in the online books/documentation, that would be great!

I needed to install Nexus3 along side our current Nexus2.x to take advantage of the new repository formats, but Nexus2.x is already running under the default service name of "nexus". How can I provide the service name that Nexus3 will run under on Windows?


Solution

  • Nexus 3 Documentation as of 2017/09/12

    https://help.sonatype.com/display/NXRM3

    The documentation now includes instructions to clarify how to install multiple instances for Nexus 3:

    https://help.sonatype.com/display/NXRM3/Installation#Installation-RunningasaServiceonWindows

    Nexus 2 Documentation as of 2017/09/12

    https://help.sonatype.com/display/NXRM2/Repository+Manager+2

    In order to install Nexus3 under a different service name on windows, you will need to use the archive(zip file) download for windows instead of the windows executable installer. Then you simply provide the name you want the service to have as the last parameter of the normal install command.

    More specific instructions:

    1. Unpack the zip file into the desired location.
    2. Open a command prompt with elevated permissions (run as administrator) and navigate to the bin directory of the unpacked nexus3 folder.
    3. To create the service:

      nexus.exe /install YourUniqueServiceName

    4. To remove the service:

      nexus.exe /uninstall YourUniqueServiceName

    Note: Creating/Removing the service this way will not delete the nexus installation nor data files; they only affect the windows service. Conversely the windows installer provides an uninstaller executable that will delete the installation files and optionally will also delete the data directory.

    Here is some other useful configuration options for changing the port and the data directory location, which you will want to do when installing multiple instances (as in the use case above). Be sure to stop the service if you've already installed it.

    To change the port:

    1. Navigate to the "etc" directory under the nexus installation location, and open the "org.sonatype.nexus.cfg" configuration properties file.

    2. Change the "application-port" property to the desired port value.

    To change the Data Directory and/or the java.io temporary directory:

    Add or modify the following commandline arguments to the "nexus.vmoptions" file in the bin directory:

    -Dkaraf.data=InsertDesiredDataDirectoryHere
    -Djava.io.tmpdir=InsertDesiredTmpDirectoryHere