DevOps- Nexus

Nexus:

→ Nexus is the artifactory registry/manager, it’s a manager service/system used to store build artifacts like .jar, .war, npm packages, yum/deb packages, docker images, helm charts.

→ It serves as a central system/storage to store and share the build packages/artifacts.

→ It is a centralized artifact registry, where we can store and share the build artifacts.

→ We can store the different versions of same packages

→ Multiple repositories are created in the Nexus, in each repository we maintain the each registry(every version of same artifact).

→ Vendor for Nexus is Sonartype Nexus

→ Nexus is developed in Java

→ It is a open source and free to use.

→ Latest version is 3.8.0

→ Port 8081

→ Alternatives of Nexus are → Jfrog, AWS Code artifact, GitHub package, Azure Artifact, Google Arifact

Difference between SCM Rep and Artifactory Repo

→ SCM Reo→ store version control and collaboration(share) on source code mainly used for storing, maintaining and using the souce code

Eg: Git Hub, Git Lab, Big Bucket, Azure Repo

→ Artifact Rep→ used to store compiled or build/deployable packages

Nexus Installation:

→ First we need to install Java in order to install the Nexus

Java Installation:

→change the directory to opt

cd /opt/

→install java, as java is downloaded in .tar we need to extract it after the download.

sudo wget https://download.java.net/openjdk/jdk17.0.0.1/ri/openjdk-17.0.0.1+2_linux-x64_bin.tar.gz

sudo tar -xvzf openjdk-17.0.0.1+2_linux-x64_bin.tar.gz

sudo rm openjdk-17.0.0.1+2_linux-x64_bin.tar.gz

sudo mv jdk-17.0.0.1 java-17

→And remove the tar file after extracting it and move the jdk to java-17

sudo ln -s /opt/java-17/bin/java /usr/bin/java

echo 'export JAVA_HOME=/opt/java-17' | sudo tee -a /etc/profile

echo 'export PATH=$PATH:$JAVA_HOME/bin' | sudo tee -a /etc/profile

source /etc/profile

Nexus Installation:

→ change the directory to opt

cd /opt

sudo wget https://download.sonatype.com/nexus/3/nexus-3.81.1-01-linux-x86_64.tar.gz

sudo tar -xzf nexus-3.81.1-01-linux-x86_64.tar.gz

sudo mv nexus-3.81.1-01 nexus

→ Nexus is downloaded in .tar file, we need to extract it and move to the nexus

→Add the user and provide permissions to the user nexus

sudo useradd nexus -r -d /opt/nexus

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

→Start and stop the Nexus

/opt/nexus/bin/nexus start

/opt/nexus/bin/nexus stop

→ There is another way to start and stop the Nexus by creating system.service file in opt directory and execute the systemctl commands to start, stop the Nexus.

sudo tee /etc/systemd/system/nexus.service > /dev/null <<EOF

[Unit]

Description=Nexus Repository Manager 3.81.1

After=network.target

[Service]

Type=forking

User=nexus

LimitNOFILE=65536

ExecStart=/opt/nexus/bin/nexus start

ExecStop=/opt/nexus/bin/nexus stop

Restart=on-failure

[Install]

WantedBy=multi-user.target EOF

sudo systemctl daemon-reload

sudo systemctl enable nexus

sudo systemctl start nexus

htttps:<ip address>:<port>

port- 8081

0
Subscribe to my newsletter

Read articles from Sandhya Kalikiri directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sandhya Kalikiri
Sandhya Kalikiri