How to Get Started With Sonatype Nexus Repository Manager OSS

January 14, 2020 By Omkar Hiremath

6 minute read time

If you plan on developing software and keep it going for a long time, repository managers play an important role. Repository managers help you optimize the storage of the packages required for the software.

Let’s consider repositories for Python programming language, for example. Python uses the PyPI repository manager. When you install Python, you get a few default functionalities, but if you want to use specific libraries, you will have to install them.

Repository managers make it easy. The packages are stored on the repository managers, and if you want to use one, you just have to get it from the repository. You don’t have to keep on looking for the artifact you want to use at different places when they are stored in a dedicated repository.

Sonatype Nexus Repository Manager OSS is one such artifact repository, and that’s what this post is about. But first let me explain why you would want to use this repository manager.

Why Do You Need a Repository Manager?

Imagine that you are building a Linux operating system of your own. You’ve put lots of effort into designing the architecture, programming the functionalities, designing the user interface, etc. You’ve published the operating system, and people really liked it.

Day by day, the number of users using your operating system is increasing. You were the only person who built the operating system, and now it’s getting difficult for you to manage it by yourself. So you decide to allow other users to add software to it.

In such cases, you can make use of a repository manager to store the software and for people to use it.

What Is Sonatype Nexus Repository Manager OSS?

Sonatype Nexus Repository Manager OSS is a free-to-use artifact repository. It supports various formats, such as Maven, APT, and Go. You can find the complete list of supported formats here.

Sonatype Nexus Repository Manager helps you host your own repositories, but you can also use the Sonatype Nexus proxy for public repositories. There is also a paid Pro version of the Sonatype Nexus Repository Manager, which you can find here.

Now that you know what Sonatype Nexus Repository Manager OSS is, let me tell you how to use it.

Setting Up Sonatype Nexus Repository Manager OSS

The first step is to download the repository manager. You can download it here for Windows, Linux, and OS X.

After downloading the file, you will have to extract it. Find the folder that contains a bin folder. That’s where you’ll have to start this tool from.

The prerequisite to use Sonatype Nexus OSS is to have Java 8 Run Time Environment (JRE). You can download it here.

To start it, open command prompt, switch to the Sonatype Nexus folder, and then into the bin directory. Then run the following command:

Windows:

nexus.exe /run

Linux:

./nexus run

Once the tool has started, you can access it using your web browser on the URL

http://localhost:8081/

This is what the home page will look like:

NexusRepoOSS

You see the supported formats and buttons for configuration, documentation, and Sonatype Nexus community. To start with repository management, you will have to sign in.

The default username is admin. You will find the default password in the path mentioned on the sign-in page.

Sonatype Nexus has a few repositories by default. You can see them under the Browse tab.

BrowseTabNexusRepoOSS

There is also an admin tab where you can set up policies, security, and much more, depending on the privileges you have. The screenshot below shows the functions available to an admin.

AdminTabNexusRepoOSS

Now, let me show you how to create a user.

Creating User

To create a user, click on the Users tab. Then fill out the details such as ID, first and last name, email, password, the status of the user (active/disabled), and the roles of that user. Then click on the Create local user button.

UserTabNexusRepoOSS

You can see the list of all the users under the Users tab.

Creating Repository

To create a repository, click on the Repository tab, and under the Repositories section, click the Create repository button.

CreateRepositoryNexusRepoOSS

Then you will have to choose the recipe of the repository. This decides what kind of file format you will be uploading and whether it’s a hosted or a proxy repository.

Then fill out the details for the repository. For example, if you choose Advanced Packaging Tool (APT), you will have to fill in details such as name, APT distribution, and signing key. If you choose PyPI, you will have to fill in details such as name, blob details, and deployment policy.

After filling in all the details, click on the Create repository button.

Uploading Content to Repository

Once you’ve created the repository, you have to add content to it. To do this, click on the Upload button on the homepage, then click on the repository you want to upload the content for. You will have to fill in details about the content and then upload the content.

Features of Sonatype Nexus Repository Manager

Not all the features are included in the free version of the Sonatype Nexus Repository Manager. To get all the features, you will have to use the Pro version. Some of the highlights are detailed below.

Security

Sonatype Nexus Repository Manager uses role-based access control. This means that the authorization you give to a particular user depends on the role of that user. The administrator has control over what authorization other users have.

Users can be given privileges to read, write, create, and update the resources. Suppose the same privileges have to be given to a number of users. In that case, you can create a collection of privileges called roles, then assign the role to the user.

Custom Metadata Tagging (Sonatype Nexus Repository Pro only)

Tagging is used extensively by the Staging feature. The staging functionality in Sonatype Nexus Repository Manager Pro supports promotion of software components matching your organization's software development life cycle phases by moving those components between repositories. This allows the creation of isolated release candidates that can be discarded or promoted to make it possible to support the decisions that go into certifying a release.

REST and Integration API

Sonatype Nexus Repository Manager provides representational state transfer (REST) application programming interfaces (APIs) that will help you if you want to integrate the repository manager with external systems. You can find APIs for almost every popular external system, such as Node, Script, and Blob. You can find the complete list of APIs here.

Webhooks

You should always address performance and real-time updates when it comes to building software. Webhooks are a great approach for real-time updating because they make a call as soon as there is something to update. Sonatype Nexus provides webhooks to notify external systems of important activities.

High Availability (Sonatype Nexus Repository Pro only)

It is important for a business model to make its product available whenever there is a requirement. Unavailability of your product might result in business loss and impact the impression users have of your organization. Sonatype Nexus uses High Availability Clustering (HA-C) to improve uptime.

To use HA-C, you need to have:

  • A test environment
  • A load balancer
  • Three separate instances of Sonatype Nexus Repository Manager
  • Connectivity between the Sonatype Nexus Repository Manager instances

If you want to learn more about Sonatype Nexus’s HA-C, you can find details here.

You will find almost everything that you need to manage repositories in Sonatype Nexus Repository Manager. Why wait? Go ahead and try it. You can start using the free version first and then switch to pro if necessary.

For further information on Sonatype Nexus Repository feature documentation and how to join the Sonatype Nexus community, please check out my.sonatype.com.

Tags: Open Source, featured, Product, Sonatype Nexus Repository, Sonatype Nexus Repository OSS

Written by Omkar Hiremath

Omkar Hiremath uses his MCA in computer science to share theoretical and demo-based learning on various areas of technology, like ethical hacking, Python, blockchain, and Hadoop.