Install Nexus Repository Manager on Ubuntu
Nexus Repository Manager on Ubuntu is a self-hosted server tool that stores and manages software packages and application files in one central place. It acts as a single source of truth for your project dependencies so you can share code and tools across different servers and computers.
Installing version 3.x of Nexus gives you a web-based hub that you open right in your browser to host your own private components and download files from public sources.
Install Java 21, download Nexus, and move its files to /opt. Create a ‘nexus’ user, configure Nexus to run as this user in /opt/nexus/bin/nexus.rc, and create a systemd service file at /etc/systemd/system/nexus.service. Start the service with `sudo systemctl start nexus`.
Install Java
Installing OpenJDK 21 is necessary because Nexus Repository Manager Ubuntu requires Java to run properly. You can set this up quickly by updating your package list and running the standard installation command for the Java Development Kit in your terminal.
Run these commands to update your system and install OpenJDK 21:
sudo apt update sudo apt install openjdk-21-jdk
You can find more details on managing Java versions at How to install and use OpenJDK on Ubuntu Linux.
Install Nexus Repository Manager
Installing Nexus Repository Manager Ubuntu involves downloading the archive file from the official source, extracting the contents, and moving the folder to the /opt directory for proper system organization and management.
Run these commands to download and extract the files:
cd /tmp wget https://download.sonatype.com/nexus/3/nexus-3.77.0-02-unix.tar.gz tar xzf nexus-3.77.0-02-unix.tar.gz sudo mv nexus-3.77.0-02 /opt/nexus sudo mv sonatype-work /opt/
Next, we create a dedicated user account to run Nexus safely. This account will not be used to log in to the system.
sudo useradd -m -d /opt/nexus -U -r -s /bin/bash nexus sudo chown -R nexus:nexus /opt/nexus /opt/sonatype-work
Configure Nexus to run on Ubuntu
Configuring Nexus Repository Manager Ubuntu requires editing the program settings to run under a dedicated user account rather than root, which keeps your server secure and ensures the application starts correctly.
Edit the configuration file to set the user:
sudo nano /opt/nexus/bin/nexus.rc
Uncomment the line and set it to: run_as_user="nexus".
For custom settings like memory limits, use the nexus.vmoptions file or the dedicated configuration directory instead of changing default files.
Now, create a system service file to manage the application:
sudo nano /etc/systemd/system/nexus.service
Paste these lines into the file:
[Unit] Description=nexus service After=network.target [Service] Type=forking LimitNOFILE=65536 ExecStart=/opt/nexus/bin/nexus start ExecStop=/opt/nexus/bin/nexus stop User=nexus Restart=on-abort [Install] WantedBy=multi-user.target
Start the service with these commands:
sudo systemctl daemon-reload sudo systemctl start nexus.service sudo systemctl enable nexus.service
To access the web interface, open your browser and go to http://your-server-ip:8081. 
The Nexus Repository Manager initial admin password is required for your first login. You can retrieve this password by running the command `sudo cat /opt/sonatype/nexus/etc/nexus-default.properties | grep -oP 'password\K.*'`. This command will display the password directly in your terminal.
sudo cat /opt/sonatype-work/nexus3/admin.password
You will be prompted to create a new, secure password. 
Run Nexus behind a proxy
Running Nexus Repository Manager behind a web server like Nginx or Apache on Ubuntu improves security and performance.
How to set up a reverse proxy with Nginx
How to set up a reverse proxy with Apache
For more official documentation, visit https://help.sonatype.com/docs.
[Unit] [Service] [Install]
What is the Nexus Repository manager?
Sonatype Nexus Repository is a software repository manager, available under both an open-source license and a proprietary license. It can combine repositories for various programming languages, so that a single server can be used as a source for building software. The open source version uses the H2 database.
Is Nexus Repository Manager free?
Understand the true cost of Sonatype Nexus including OSS vs Pro differences, self-hosted TCO, and how pricing actually works. Compare with predictable alternatives. Nexus Repository OSS is free. Completely free.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!