Nexus: An Open source Repository
Send me Nitor Infotech's Monthly Blog Newsletter!
×
nitor logo
  • Company
    • About
    • Leadership
    • Partnership
  • Resource Hub
  • Blog
  • Contact
nitor logo
Add more content here...
Artificial intelligence Big Data Blockchain and IoT
Business Intelligence Careers Cloud and DevOps
Digital Transformation Healthcare IT Manufacturing
Mobility Product Modernization Software Engineering
Thought Leadership
Aastha Sinha Abhijeet Shah Abhishek Suranglikar
Abhishek Tanwade Abhishek Tiwari Ajinkya Pathak
Amit Pawade Ankita Kulkarni Ankita Patidar
Antara Datta Anup Manekar Ashish Baldota
Chandra Gosetty Deep Shikha Bhat Dr. Girish Shinde
Ekta Shah Gaurav Mishra Gaurav Rathod
Gautam Patil Harish Singh Chauhan Harshali Chandgadkar
Kapil Joshi Krishna Gunjal Madhavi Pawar
Marappa Reddy Mayur Wankhade Milan Pansuriya
Minal Doiphode Mohit Agarwal Mohit Borse
Nalini Vijayraghavan Nikhil Kulkarni Omkar Ingawale
Omkar Kulkarni Pooja Chavan Pooja Dhule
Pranit Gangurde Prashant Kankokar Priya Patole
Rahul Ganorkar Rashmi Nehete Ravi Agrawal
Robin Pandita Rohan Chavan Rohini Wwagh
Sachin Saini Sadhana Sharma Sambid Pradhan
Sandeep Mali Sanjay Toge Sanjeev Fadnavis
Saurabh Pimpalkar Sayanti Shrivastava Shardul Gurjar
Shravani Dhavale Shreyash Bhoyar Shubham Kamble
Shubham Muneshwar Shubham Navale Shweta Chinchore
Sidhant Naveria Souvik Adhikary Sujay Hamane
Tejbahadur Singh Uddhav Dandale Vasishtha Ingale
Vidisha Chirmulay Yogesh Kulkarni
Software Engineering | 11 Nov 2022 |   12 min

Nexus: An Open source Repository

featured image

Nexus is a Sonatype Artifactory repository manager [OSS]. It allows you to store, distribute, and retrieve build artifacts whenever it’s required. Using Nexus, developers can easily access and deploy build artifacts in an organization from a single location. What’s more, they can be easily distributed.

It is mostly used for hosting Apache Maven, and currently supports formats like Docker, Maven, npm, NuGet, Ruby Gems, Yum proxy/host, Apt*, R*, Raw, P2* and more.

Nexus is available in Nexus OSS and Nexus Pro versions. Nexus Pro has features like LDAP, Auth tokens, Runtime storage expansion/migration, Advanced repository health check, custom component metadata and deploy to npm and docker groups.

In my blog today, I’m going to walk you through what Nexus is made up of.

First, let’s take a look at the directory structure of Nexus.

Directory Structure:

bin: It contains Nexus startup script and related configuration files.

etc: It contains all the configuration files.

lib: It contains binary libraries.

Public: It contains public resources of the application.

System: it contains all the components and plugins.

Data Directory:

The default location of data directory is ../Sona type-work/nexus3. It includes subdirectories that contain all the components, repositories, configurations, and other data of the repository manager.

The subdirectories are:

Blobs/:

It is the default location of the blob store, provide a fully qualified path when creating a new blob store, it may not end up in this directory.

Cache/:

It contains information on currently cached Karaf bundles [Karaf can be used as a standalone container supporting wide range of applications and technologies].

Db/:

It contains the orient db databases which are the primary storage for our repository manager’s metadata.

Elastic search/:

It contains the currently configured state of Elasticsearch [Elasticsearch allows us to store, search and analyze huge volumes of data quickly].

Health-check/:

It contains cached reports from the repository health check feature.

Keystores/:

It contains the automatically generated key used to identify our repository manager.

Log/:

It contains several log files information regarding various running repository manager.log files found in this directory include:

  • nexus.log: It is a main repository application log, log messages having standard log output fields like date/time, log level, class, and message.
  • request.log: It is used to log http access requests to a running container manager. This log messages contain information like client host, user and HTTP request attribute including status code, bytes, and user-agent header.
  • jvm.log: It contains JVM stdout, stderr and thread dump messages.
  • Karaf.log: It contains messages specific to the repository manager startup. This log having a subdirectory called tasks. It contains separate, uniquely named [by date, time, and task name] log output files for each task that is run.

tmp/:

It can be used for temporary storage.

Nexus provides for the three different kinds of repositories:

Proxy:

A repository that is linked to a remote repository, Nexus configured with the Apache snapshots and central proxy repositories. Any request for a component is verified against the local content of the proxy repository, if a local component is not found the request is forwarded to the remote repository.

Hosted:

It is hosted by the repository manager and configured with the third party, releases, and snapshots.

Group:

It has its own access point and a combined repository of locally published and remotely cached components.

Now that you are familiar with what Nexus can provide, allow me to explain the benefits of Nexus.

Benefits of Nexus:

  • Nexus allows us to proxy, collect, and manage our dependencies so that we are not focused constantly on collection of jars.
  • We can deploy artifacts into Nexus with their version controls like snapshot in Maven.
  • We need to install our artifacts by just using mvn install command, it can download all the dependencies from artifact repo. These are organized and available for all the team members.
  • Nexus can be integrated with any CI/CD tool like Jenkins, Bamboo etc. Pipelines can publish and retrieve versioned apps and their dependencies.
  • We can block any uploads that we don’t want thanks to Nexus.
  • We can restrict access to Nexus repositories for users by roles and user permissions.

Allow me to explain further with the help of two interesting case studies.

Case study I: Deploy Maven artifacts into Nexus repo

Deploy Maven artifacts into Nexus repo

  • Developers can pull the code in to scm repository GitHub/bitbucket.
  • We can use maven clean install command for creating artifacts like jar, war, and ear.
  • Here, we need to integrate nexus with the maven. Whenever we can pass maven goals, it’s first read pom.xml file.
  • We need to update Nexus URL details [snapshots and releases] under the distribution management section in pom.xml file and credential details need to update in the settings.xml file.
  • Maven can check all the dependencies in local repository initially, if not available in local it will search in maven central repository, if not available in central it will search in remote repository [nexus] based on the details provided in pom.xml file.
  • We will use a proxy server for securely uploading and pulling the artifacts from remote repository.
  • We can integrate nexus with the CI/CD tools like Jenkins, bamboo etc.

Case study II: Deploy Docker images into Nexus repo

Deploy Docker images into Nexus repo

  • Developers commit the code into Bitbucket repo.
  • They create a repository in Nexus for docker images, while creating, select the http connector at specified port and mentioned the port number.
  • They write the docker file for creating the docker images.
  • They create a docker image with the docker file
docker build -t <Docker file path>
  • They need to login to nexus repo with docker.
docker login <nexus repo url path>
  • They match the image with repository.
docker tag <image Id or image Name> <nexus-hostname>:<repository-port>/<image>:<tag>
  • They push the docker image to Nexus repo.
docker push <nexus-hostname>:<repository-port>/<image>:<tag>

Here are the steps you should follow for Nexus installation in Linux machine:

Login as a root user.

sudo su -

cd /opt

yum install tar wget -y

wget http://download.sonatype.com/nexus/3/nexus-3.15.2-01-unix.tar.gz

tar -zxvf nexus-3.15.2-01-unix.tar.gz

mv /opt/nexus-3.15.2-01 /opt/nexus

Create a Nexus user.

useradd nexus

Give the sudo access to Nexus user.

$ visudo

nexus ALL=(ALL) NOPASSWD: ALL

Change ownerships and permissions.

chown -R nexus:nexus /opt/nexus

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

chmod -R 775 /opt/nexus

chmod -R 775 /opt/sonatype-work

Open /opt/nexus/bin/nexus.rc file and uncomment run_as_user parameter and set as nexus user.

vi /opt/nexus/bin/nexus.rc

run_as_user="nexus"

Create Nexus as a service.

ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

Switch to Nexus user.

su - nexus

Enable and start Nexus.

sudo systemctl enable nexus

sudo systemctl start nexus

I hope my blog has acquainted you with the workings of Nexus! Reach out to us with your feedback about this blog and visit us at Nitor Infotech to learn more about us.

Related Topics

Artificial intelligence

Big Data

Blockchain and IoT

Business Intelligence

Careers

Cloud and DevOps

Digital Transformation

Healthcare IT

Manufacturing

Mobility

Product Modernization

Software Engineering

Thought Leadership

<< Previous Blog fav Next Blog >>
author image

Marappa Reddy

Senior Software Engineer

Marapareddy, a senior software engineer at Nitor Infotech, has 4+ years of experience using DevOps tools like Jenkins, Ansible, and Nexus. He is proficient with Linux Operating systems like RedHat, Centos and Ubuntu, CI/CD pipelines for automation by Jenkins with Maven and Npm as a build tools. He has successfully created ansible scripts for configuration and deployment automation. He loves learning new technologies and has a soft spot for those related to DevOps and Cloud. His hobbies include farming and listening to music.

   

You may also like

featured image

15 Performance Improvement Techniques for Your iOS App

In the world of iOS app development, app performance refers to the speed, responsiveness, and ...
Read Blog


featured image

The Ultimate Guide to Different Types of Testing

In today’s competitive scenario, businesses that want to stand out against their peers must invest in building best-in-class software that is performant and failure-proof. To ensure sustained funct...
Read Blog


featured image

The Importance of ChatGPT and Why it is Becoming Popular

Imagine having a conversation with a chatbot that feels almost human. That’s exactly what OpenAI ChatGPT brings to the table. The remarkable technology of Generative Pre-trained Transformer (GPT) p...
Read Blog


subscribe

Subscribe to our fortnightly newsletter!

We'll keep you in the loop with everything that's trending in the tech world.

Services

    Modern Software Engineering


  • Idea to MVP
  • Quality Engineering
  • Product Engineering
  • Product Modernization
  • Reliability Engineering
  • Product Maintenance

    Enterprise Solution Engineering


  • Idea to MVP
  • Strategy & Consulting
  • Enterprise Architecture & Digital Platforms
  • Solution Engineering
  • Enterprise Cognition Engineering

    Digital Experience Engineering


  • UX Engineering
  • Content Engineering
  • Peer Product Management
  • RaaS
  • Mobility Engineering

    Technology Engineering


  • Cloud Engineering
  • Cognitive Engineering
  • Blockchain Engineering
  • Data Engineering
  • IoT Engineering

    Industries


  • Healthcare
  • Retail
  • Manufacturing
  • BFSI
  • Supply Chain

    Company


  • About
  • Leadership
  • Partnership
  • Contact Us

    Resource Hub


  • White papers
  • Brochures
  • Case studies
  • Datasheet

    Explore More


  • Blog
  • Career
  • Events
  • Press Releases
  • QnA

About


With more than 16 years of experience in handling multiple technology projects across industries, Nitor Infotech has gained strong expertise in areas of technology consulting, solutioning, and product engineering. With a team of 700+ technology experts, we help leading ISVs and Enterprises with modern-day products and top-notch services through our tech-driven approach. Digitization being our key strategy, we digitally assess their operational capabilities in order to achieve our customer's end- goals.

Get in Touch


  • +1 (224) 265-7110
  • marketing@nitorinfotech.com

We are Social 24/7


© 2023 Nitor Infotech All rights reserved

  • Terms of Usage
  • Privacy Policy
  • Cookie Policy
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Accept Cookie policy