How to Install Nexus Repository Manager on Ubuntu 24.04 LTS

In this article we are going to cover How to Install Nexus Repository Manager on Ubuntu 24.04 LTS.

In today’s software development environment, effective dependency management and artifact storage are essential for high-quality applications. Nexus Repository, an open-source tool by Sonatype, offers a powerful solution for managing binaries, libraries, and other artifacts throughout the development lifecycle. It streamlines collaboration by enabling teams to efficiently share and deploy artifacts.

This article provides a step-by-step guide to installing Nexus Repository on Ubuntu 24.04 LTS. Whether you’re an experienced developer or just starting, this guide will help you set up your Nexus instance to enhance your development workflow. Let’s get started!

Prerequisites

  • Ubuntu 24.04 LTS with minimal installation
  • SSH Access with admin privileges

Install OpenJDK 17 on Ubuntu 24.04 LTS

Install OpenJDK 17 on Ubuntu 24.04 LTS

sudo apt update
sudo apt install openjdk-17-jdk -y

Verify the installation:

java -version
How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 1

Download and Install Nexus Repository Manager on Ubuntu 24.04 LTS

Go to the Nexus Repository downloads page and copy the link for the latest version. Then, use get to download it.

cd /opt
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz

Once the download is complete, extract the tarball:

sudo tar -xvzf latest-unix.tar.gz

Rename the extracted Nexus setup folder to nexus:

sudo mv /opt/nexus-3.73.0-12 /opt/nexus

As security practice, not to run nexus service using root user, so lets create new user named nexus to run nexus service:

sudo adduser nexus

To set no password for nexus user open the visudo file in ubuntu:

sudo visudo

Add below line into it , save and exit:

nexus ALL=(ALL) NOPASSWD: ALL

Give permission to nexus files and nexus directory to nexus user:

sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work

To run nexus as service at boot time, open /opt/nexus/bin/nexus.rc file, uncomment it and add nexus user as shown below:

sudo nano /opt/nexus/bin/nexus.rc

uncomment and add:

run_as_user="nexus"

Open the /opt/nexus/bin/nexus.vmoptions file:

sudo nano /opt/nexus/bin/nexus.vmoptions

To Increase the nexus JVM heap size, you can modify the size as shown below:

-XX:MaxDirectMemorySize=2703m
-Djava.net.preferIPv4Stack=true
How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 2

Run Nexus as a service using Systemd

To run nexus as service using Systemd:

sudo nano /etc/systemd/system/nexus.service

insert the below content:

[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 Nexus:

sudo systemctl start nexus

Enable Nexus service at system startup:

sudo systemctl enable nexus

check nexus service status:

sudo systemctl status nexus
How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 3

Access Nexus Repository on Web Interface

To access Nexus repository web interface , open your browser.

if you are running UFW firewall on Ubuntu, open the firewall port 8081 using below command:

ufw allow 8081/tcp

Use the below command to open to access Nexus repository web interface:

http://server_IP:8081

you will see below default nexus page:

How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 4

To login to Nexus, click on Sign In, default username is admin

To find default password run the below command:

sudo nano /opt/sonatype-work/nexus3/admin.password

copy the default nexus password and login, you can reset the password once logged in to nexus:

How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 5

Below nexus setup wizard will show:

How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 6

Change the default nexus admin password:

How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 7

configure Anonymous Access:

How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 8

click on Finish:

How to Install Nexus Repository Manager on Ubuntu 24.04 LTS 9

Conclusion:

In this article we have covered How to Install Nexus Repository Manager on Ubuntu 24.04 LTS.

You have successfully installed Nexus Repository on Ubuntu 24.04 LTS! With your Nexus instance operational, you can now efficiently manage and store your software artifacts, enhancing your development workflow. Explore its features to customize your artifact management and consider integrating it with your CI/CD pipelines for even greater efficiency.

Related Articles:

How to Install Nexus Repository on Ubuntu 20.04 LTS

Harish Reddy

5 thoughts on “How to Install Nexus Repository Manager on Ubuntu 24.04 LTS”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap