Install Nexus Repository
The Nexus Repository distribution archives combine the application and required resources in an archive file. When testing Nexus Repository on a local workstation, the files may be extracted and run in any environment that supports a Java runtime.
Many decisions must be considered before deploying Nexus Repository. New installations are configured to start with an embedded H2 database with components stored in the local file system. Using the start script from the command line is not resilient to server crashes. While this may be fine for testing, they are not ideal for production deployments.
Review the Planning Your Deployment documentation before proceeding.
Unpack the Archive
The distribution archives are designed to be unpacked from the command line to avoid replacing or overwriting existing files in the directory. The command should create any missing files or directories.
Unpack the archive with the following command:
tar xvzf
Do not run Nexus Repository from a user's home directory for production deployments; a common practice is to use the /opt
directory.
See Directories for a complete description of all files and folders in the archive.
As the user account that runs Nexus Repository, download or copy the bundle into the Nexus Repository 3 Installation Directory.
See the Downloads page.
Extract the archive using a command specific to your bundle format.
tar xvzf nexus-unix-x86-64-3.78.0-14.tar.gz tar xvzf nexus-unix-aarch64-3.78.0-14.tar.gz tar xvzf nexus-mac-x86-64-3.78.0-14.tar.gz tar xvzf nexus-mac-aarch64-3.78.0-14.tar.gz
Extracting the archive populates the Application Directory and the parent of the default Data Directory.
./nexus-3.78.0-14 ./sonatype-work
Running Nexus Repository
The archive in the Application directory includes a script to use to start the application. This script accepts the following commands:
start, stop, run, restart, force-reload, status
To start the Nexus Repository:
./nexus start
Logging is outputted to the application log file.
To stop the Nexus Repository running in the background:
./nexus stop
The application may run with logging displayed in the current shell for testing with the run command:
./nexus run
Starting with the run
command leaves the application running in the current shell. The application can be stopped using CTRL+C
in the console.
Running as a Service
Nexus Repository needs to be configured to run as a service when installing the software for production usage. This is so that the service restarts properly after the server reboots.
See Run as a Service
Microsoft Windows Environments
The zip archive can be unpacked using the Windows compression utility or a third-party utility such as 7zip. Nexus Repository is not installed in the Program Files
directory.
You may install Nexus Repository in the AppData\Local
directory of a specific user's home directory or use a folder in the system root. (e.g., C:\nexus
). Make sure the system user has full access to the application and directories.
Use the bin\install-nexus-service.bat
to install Nexus Repository on your Windows server. When upgrading, uninstall previous versions before running this script.
Use the nexus.exe
executable in the start service with the following commands:
Start the service: .\nexus.exe //ES//SonatypeNexusRepository Stop the service: .\nexus.exe //SS//SonatypeNexusRepository Uninstall the service: .\nexus.exe //DS//SonatypeNexusRepository
Nexus.exe Commands Before Release 3.78.0
Release 3.78.0 includes many changes to the way Nexus Repository is built. The tooling to build the nexus.exe package requires an alternate configuration as listed above.
Use the following command for version before 3.78.0.
start, stop, run, restart, force-reload, status
Access the User Interface
When Nexus Repository starts, access the web application user interface using a web browser navigating to the service URL:
http://<host_ip>:<port>
To test this on the server Nexus Repository is hosted, navigate to the localhost.
http://localhost:8081/
You may need to use the loopback address 127.0.0.1
depending on the DNS hostname assigned to the server.
Nexus Repository includes an administrative user with full access. The username is admin and the initial password is found in a temporary file named admin.password
located in the $data-dir
directory.
Post Install Checklist
After installing Nexus Repository, complete the tasks below to ensure your Nexus Repository instance's security.
Change the Admin Password
Nexus Repository generates a unique random password during the system’s initial startup to keep the system in a secure state. The system owner will need to retrieve the initial password from the filesystem to log in. The password must be changed before using Nexus Repository through the start wizard in the user interface or the REST API.
The
admin.password
file is saved in the$data-dir
.Configure Anonymous Access
When using the user interface another step in the wizard is configuring whether anonymous access is allowed in the system. Until configured the system will allow unauthenticated users to read the contents of repositories.
Change the Administrative Email Address
The admin user comes with a default email address configured and, since this address is not going to be very useful to anyone, see Working with Your User Profile for details.
Configure the SMTP Settings
The repository manager can send username and password recovery emails. To enable this feature, you will need to configure an SMTP Host and Port as well as any necessary authentication parameters that the repository manager needs to connect to the mail server.
Configure Default HTTP and HTTPS Proxy Settings
In many deployments, the internet, and therefore any remote repositories that the repository manager needs to proxy, can only be reached via an HTTP or HTTPS proxy server internal to the deployment company. In these cases, the connection details to that proxy server need to be configured for the repository manager to be able to proxy remote repositories at all.
Set Up a Backup Procedure for Your Server
Read and utilize Backup and Restore. Things happen and it is always advisable to back up your configurations and data on a scheduled basis.
Set Up Routing Rules
Set up routing rules to prevent issues such as a name hijacking attack where a malicious user creates packages in a registry with names used by your internal projects.
Require User Tokens for Repository Access
Consider configuring token-based access.
Set Up Maintenance Tasks
You should set up the following essential maintenance tasks:
Maven - Delete unused SNAPSHOTS Docker - Delete incomplete uploads Admin - Compact blob store
Set Up Cleanup Policies
In your repository settings, set up cleanup policies.
Configure the Runtime Environments
The following offers detailed guidance on setting and optimizing Nexus Repository, including examples and best practices for various deployment scenarios.
Configuring the Runtime Environment
This provides detailed information on configuring the Java Virtual Machine (JVM) environment for Nexus Repository, including how to edit the configuration to adjust memory settings.
Nexus Repository Memory Overview
A comprehensive overview of memory configuration for Nexus Repository, including explanations of different memory types and example configurations for various deployment sizes.
Nexus Repository System Requirements
Specific recommendations for memory configurations based on the amount of RAM available on your system.
Nexus Reference Architecture
Nexus Repository is deployed in many configurations based on your use case. You have no limit on the number of instances you may deploy. We offer a number of reference architecture and deployment patterns to review when planning your deployment.
Deployment Options
Nexus Repository can be deployed in various ways to suit your needs, including: as a standalone application, in a containerized environment (like Docker or Kubernetes), or in cloud-based solutions. Choose the option that best aligns with your infrastructure, scalability, and high availability requirements.
Helm Chart
Sonatype provides a Helm Chart to use for on-premises, AWS, and Azure resiliency and high availability deployment (HA) options.
Docker
Docker automates the deployment of applications inside virtualized Linux containers. You can create a container that supports the installation of Nexus Repository.
OpenShift Operator
An OpenShift operator is available for Nexus Repository deployments. This deployment requires that Nexus Repository use an external PostgreSQL database. The operator also supports deploying in high availability (active/active) mode.