How to get started with Nexus Repository Manager?

data codes through eyeglasses
Reading Time: 4 minutes

What is Repository Manager?

An repository manager allows to store and retrieve build artifacts. Repository management is a foundational step in a broader trend towards managing binary components across your software supply
chain and throughout the software development life cycle. Also, it can be considered as:

  • A proxy for remote repositories which caches artifacts saving both bandwidth and time required to retrieve a software artifact from a remote repository, and
  • A host for internal artifacts providing an organisation with a deployment target for software artifacts

In addition to these two core features, a repository manager also allows you to manage binary software artifacts through the software development, quality assurance, and production release life cycle. In addition to these core features, a repository manager can search software artifacts, audit development and release transactions, and integrate with external security systems such as LDAP. A repository manager is a powerful tool that encourages collaboration and provides visibility into the workflow which surrounds binary software artifacts.

What is Nexus?

Nexus is a repository manager. It allows you to proxy, collect, and manage your dependencies so that you are not constantly juggling a collection of JARs. It makes it easy to distribute your software. Internally, you configure your build to publish artifacts to Nexus and they then become available to other developers. You get the benefits of having your own ‘central’, and there is no easier way to collaborate.

Nexus Repository Manager Formats

Nexus Repository delivers universal support for package managers and formats. Nexus Repository Manager supports an evolving list of official and community repository formats. Formats are free to use, regardless of product license.

What are components?

A component is a resource like a library or a framework that is used as part of your software application at runtime, integration or unit test execution time or required as part of your build or deployment process.
It can also be an entire application or a static resource, like an image, without any dynamic behaviour. Even an entire operating system can be viewed as a component when used with container-based systems such as Docker.

Typically, components are archives of a large variety of files such as Java byte code in class files, C object files, binary files such as images, PDF files, sound and music files and many more. The archives use a variety of formats such as Java JAR, WAR, EAR formats; plain ZIP or .tar.gz files; other package formats such as NuGet packages, RubyGems, npm packages, Docker images, and others.

In various toolchains components are called ‘artifacts’, ‘packages’, ‘bundles’, ‘archives’, ‘images’ and other
terms. The concept is the same and we use ‘component’ as the independent, generic term.

Repository Management

Creating and managing repositories is an essential part of your Nexus Repository configuration, since it allows you to expose more components to your users. It supports proxy repositories, hosted repositories and repository groups in a number of different repository formats.

Repository Types

Proxy Repository

A repository with the type proxy, also known as a proxy repository, is a repository that is linked to a remote repository. Any request for a component is verified against the local content of the proxy repository. If no local component is found, the request is forwarded to the remote repository. The component is then retrieved and stored locally in the repository manager, which acts as a cache. Subsequent requests for the same component are then fulfilled from the local storage, therefore eliminating the network bandwidth and time overhead of retrieving the component from the remote repository again.


Hosted Repository

A repository with the type hosted, also known as a hosted repository, is a repository that stores components in the repository manager as the authoritative location for these components.


Repository Group

A repository with the type group, also known as repository group, represents a powerful feature of Nexus Repository Manager. They allow you to combine multiple repositories and other repository groups in a single repository. This in turn means that your users can rely on a single URL for their configuration needs, while the administrators can add more repositories and therefore components to the repository group.

Setting Up 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 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 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/

Installing With Docker

To run, binding the exposed port 8081 to the host and use persistent storage as requirements:

 docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3

Default credentials are: admin / admin123.It can take some time (2-3 minutes) for the service to launch in a new container. You can tail the log to determine once Nexus is ready.

Installing With Helm chart:

helm repo add sonatype https://sonatype.github.io/helm3-charts/

helm install nexus-rm sonatype/nexus-repository-manager [ --version v29.2.0 ]

Once Installed Successfully, this is what the home page will look like:

Conclusion

Nexus Repository Manager is a FREE-to-use artifact repository manager by Sonatype. It supports a wide variety of formats like APT, NuGET, Maven and Docker. Nexus Repository Manager centralizes the way binaries are controlled, stored and managed and can be considered as Universal binary repository manager.

Written by 

I am an DevOps engineer having experience working with the DevOps tool and technologies like Kubernetes, Docker, Ansible, AWS cloud, prometheus, grafana etc. Flexible towards new technologies and always willing to update skills and knowledge to increase productivity.

Leave a Reply