ansible
protobuf
+
elasticsearch
*
+
argocd
mvn
notepad++
fortran
+
+
+
junit
+
bbedit
+
erlang
flask
+
atom
+
+
+
+
netlify
+
+
xgboost
junit
+
+
nim
pytest
+
+
k8s
sublime
quarkus
+
xgboost
+
express
+
rb
+
f#
+
+
+
android
marko
+
+
cargo
tcl
+
+
?
+
+
+
sinatra
+
play
postgres
+
intellij
next
+
gentoo
intellij
+
websocket
android
*
+
swift
sqlite
<-
+
+
fortran
+
+
+
+
termux
+
+
Back to Blog
๐Ÿ“ฆ Nexus Repository Manager on AlmaLinux: Central Hub for All Your Artifacts
nexus repository almalinux

๐Ÿ“ฆ Nexus Repository Manager on AlmaLinux: Central Hub for All Your Artifacts

Published Sep 6, 2025

Master Nexus Repository on AlmaLinux! Learn installation, Maven/npm/Docker repository setup, proxy configuration, and artifact management. Perfect DevOps repository solution!

5 min read
0 views
Table of Contents

๐Ÿ“ฆ Nexus Repository Manager on AlmaLinux: Central Hub for All Your Artifacts

Welcome to unified artifact management! ๐ŸŽ‰ Ready to centralize all your dependencies and packages? Nexus Repository Manager OSS is the free, powerful repository manager that stores and manages your Maven, npm, Docker, and 20+ other formats! Itโ€™s the platform that becomes your single source of truth for all artifacts! Think of it as your universal package warehouse! ๐Ÿš€โœจ

๐Ÿค” Why is Nexus Important?

Nexus revolutionizes artifact management! ๐Ÿš€ Hereโ€™s why itโ€™s amazing:

  • ๐Ÿ“ฆ Universal Storage - Maven, npm, Docker, PyPI, and more!
  • ๐Ÿ”„ Proxy Repositories - Cache external dependencies!
  • ๐ŸŽฏ Single Source - One place for all artifacts!
  • ๐Ÿ”’ Access Control - Fine-grained permissions!
  • ๐Ÿ“Š Repository Health - Monitor artifact quality!
  • ๐Ÿ†“ Completely Free - OSS edition forever!

Itโ€™s like having your own private package hub! ๐Ÿ’ฐ

๐ŸŽฏ What You Need

Before building your repository hub, ensure you have:

  • โœ… AlmaLinux 9 server
  • โœ… Root or sudo access
  • โœ… At least 4GB RAM (8GB recommended)
  • โœ… 4 CPU cores minimum
  • โœ… 50GB free disk space
  • โœ… Java 8 or 11
  • โœ… Love for organized artifacts! ๐Ÿ“ฆ

๐Ÿ“ Step 1: System Preparation - Getting Ready!

Letโ€™s prepare AlmaLinux 9 for Nexus! ๐Ÿ—๏ธ

# Update system packages
sudo dnf update -y

# Install Java 8 (Nexus requirement)
sudo dnf install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel

# Verify Java installation
java -version
# Should show: openjdk version "1.8.0_xxx"

# Create nexus user (no home directory needed)
sudo useradd -r -m -U -d /opt/nexus -s /bin/bash nexus

# Create necessary directories
sudo mkdir -p /opt/nexus
sudo mkdir -p /opt/sonatype-work

# Install required tools
sudo dnf install -y wget tar

Configure firewall for Nexus:

# Open Nexus port
sudo firewall-cmd --permanent --add-port=8081/tcp
# Open Docker registry port (if using)
sudo firewall-cmd --permanent --add-port=8082/tcp
sudo firewall-cmd --reload

# Verify ports
sudo firewall-cmd --list-ports
# Should show: 8081/tcp 8082/tcp

Configure system limits for Nexus:

# Increase file descriptors
sudo tee -a /etc/security/limits.conf << 'EOF'
nexus - nofile 65536
nexus - nproc 4096
EOF

# Create systemd override directory
sudo mkdir -p /etc/systemd/system/nexus.service.d/

# Set limits for systemd service
sudo tee /etc/systemd/system/nexus.service.d/override.conf << 'EOF'
[Service]
LimitNOFILE=65536
EOF

Perfect! System is ready! ๐ŸŽฏ

๐Ÿ”ง Step 2: Installing Nexus - The Manual Way!

Letโ€™s install Nexus Repository Manager! ๐Ÿš€

Download and Extract Nexus:

# Download latest Nexus OSS (check for latest version)
cd /tmp
NEXUS_VERSION="3.61.0-02"
wget https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz

# Extract to /opt
sudo tar -xzf nexus-${NEXUS_VERSION}-unix.tar.gz -C /opt/

# Rename for simplicity
sudo mv /opt/nexus-${NEXUS_VERSION} /opt/nexus/nexus
sudo mv /opt/sonatype-work /opt/nexus/

# Set ownership
sudo chown -R nexus:nexus /opt/nexus

# Verify installation
ls -la /opt/nexus/
# Should show: nexus and sonatype-work directories

Configure Nexus:

# Configure Nexus to run as nexus user
echo 'run_as_user="nexus"' | sudo tee /opt/nexus/nexus/bin/nexus.rc

# Configure JVM options
sudo vi /opt/nexus/nexus/bin/nexus.vmoptions

# Modify these settings:
# -Xms2048m
# -Xmx2048m
# -XX:MaxDirectMemorySize=3g
# -Djava.util.prefs.userRoot=/opt/nexus/sonatype-work/nexus3

Create Systemd Service:

# Create service file
sudo tee /etc/systemd/system/nexus.service << 'EOF'
[Unit]
Description=Nexus Repository Manager
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/opt/nexus/nexus/bin/nexus start
ExecStop=/opt/nexus/nexus/bin/nexus stop
Restart=on-failure
RestartSec=20

[Install]
WantedBy=multi-user.target
EOF

# Reload systemd
sudo systemctl daemon-reload

# Enable and start Nexus
sudo systemctl enable nexus
sudo systemctl start nexus

# Check status
sudo systemctl status nexus
# Should show: active (running)

๐ŸŒŸ Step 3: Initial Setup - Your Repository Hub!

Time to configure Nexus! ๐ŸŽฎ

Access Nexus:

# Wait for Nexus to fully start (2-3 minutes)
# Check logs
sudo tail -f /opt/nexus/sonatype-work/nexus3/log/nexus.log
# Look for: "Started Sonatype Nexus"

# Get initial admin password
sudo cat /opt/nexus/sonatype-work/nexus3/admin.password
# Save this password!

# Access Nexus
# URL: http://your-server-ip:8081
# Username: admin
# Password: (from admin.password file)

Setup Wizard:

  1. Login with admin credentials
  2. Change admin password immediately
  3. Configure Anonymous Access:
    • Enable for public repositories
    • Disable for private setup
  4. Complete setup

Dashboard shows:

  • ๐Ÿ“ฆ Browse - View repositories
  • ๐Ÿ”ง Administration - System settings
  • ๐Ÿ” Search - Find artifacts
  • ๐Ÿ“Š Support - Help resources

โœ… Step 4: Creating Repositories - Letโ€™s Store Artifacts!

Time to create repositories for different formats! ๐ŸŽฏ

Create Maven Repository:

  1. Go to Administration โ†’ Repositories
  2. Click โ€œCreate repositoryโ€
  3. Select โ€œmaven2 (hosted)โ€
  4. Configure:
    • Name: maven-releases
    • Version policy: Release
    • Layout policy: Strict
    • Deployment policy: Disable redeploy
  5. Create repository

Create snapshots repository:

  1. Create another maven2 (hosted)
  2. Configure:
    • Name: maven-snapshots
    • Version policy: Snapshot

Create npm Repository:

  1. Create repository โ†’ npm (hosted)
  2. Configure:
    • Name: npm-private
    • Deployment policy: Allow redeploy
  3. Create repository

Create Docker Registry:

  1. Create repository โ†’ docker (hosted)
  2. Configure:
    • Name: docker-private
    • HTTP port: 8082
    • Enable Docker V1 API: โœ“ (if needed)
  3. Create repository

Create Proxy Repositories:

# Maven Central Proxy
# 1. Create repository โ†’ maven2 (proxy)
# 2. Configure:
#    - Name: maven-central
#    - Remote URL: https://repo1.maven.org/maven2/
#    - Use certificates: unchecked

# npm Registry Proxy
# 1. Create repository โ†’ npm (proxy)
# 2. Configure:
#    - Name: npm-registry
#    - Remote URL: https://registry.npmjs.org

# Docker Hub Proxy
# 1. Create repository โ†’ docker (proxy)
# 2. Configure:
#    - Name: docker-hub
#    - Remote URL: https://registry-1.docker.io
#    - Docker Index: Use Docker Hub

Create Group Repositories:

  1. Create repository โ†’ maven2 (group)
  2. Configure:
    • Name: maven-public
    • Member repositories:
      • maven-releases
      • maven-snapshots
      • maven-central
  3. Create repository

๐ŸŒŸ Step 5: Using Nexus - Upload and Download!

Letโ€™s use our repositories! ๐ŸŽฏ

Configure Maven:

<!-- Add to ~/.m2/settings.xml -->
<settings>
  <servers>
    <server>
      <id>nexus-releases</id>
      <username>admin</username>
      <password>your-password</password>
    </server>
    <server>
      <id>nexus-snapshots</id>
      <username>admin</username>
      <password>your-password</password>
    </server>
  </servers>
  
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://your-server-ip:8081/repository/maven-public/</url>
    </mirror>
  </mirrors>
</settings>

Deploy to Nexus:

<!-- Add to pom.xml -->
<distributionManagement>
  <repository>
    <id>nexus-releases</id>
    <url>http://your-server-ip:8081/repository/maven-releases/</url>
  </repository>
  <snapshotRepository>
    <id>nexus-snapshots</id>
    <url>http://your-server-ip:8081/repository/maven-snapshots/</url>
  </snapshotRepository>
</distributionManagement>

<!-- Deploy with: mvn deploy -->

Configure npm:

# Set registry for your scope
npm config set @mycompany:registry http://your-server-ip:8081/repository/npm-private/

# Login to Nexus
npm login --registry=http://your-server-ip:8081/repository/npm-private/
# Username: admin
# Password: your-password
# Email: [email protected]

# Publish package
npm publish --registry=http://your-server-ip:8081/repository/npm-private/

# Install from Nexus
npm install @mycompany/package --registry=http://your-server-ip:8081/repository/npm-public/

Configure Docker:

# Configure Docker for insecure registry
sudo vi /etc/docker/daemon.json
{
  "insecure-registries": ["your-server-ip:8082"]
}

# Restart Docker
sudo systemctl restart docker

# Login to Nexus Docker registry
docker login your-server-ip:8082
# Username: admin
# Password: your-password

# Tag and push image
docker tag myapp:latest your-server-ip:8082/myapp:latest
docker push your-server-ip:8082/myapp:latest

# Pull from Nexus
docker pull your-server-ip:8082/myapp:latest

๐ŸŽฎ Quick Examples

Example 1: CI/CD Integration

// Jenkins Pipeline example
pipeline {
    agent any
    
    stages {
        stage('Build') {
            steps {
                sh 'mvn clean package'
            }
        }
        
        stage('Deploy to Nexus') {
            steps {
                sh '''
                    mvn deploy:deploy-file \
                        -DgroupId=com.example \
                        -DartifactId=myapp \
                        -Dversion=${BUILD_NUMBER} \
                        -Dpackaging=jar \
                        -Dfile=target/myapp.jar \
                        -DrepositoryId=nexus-releases \
                        -Durl=http://nexus:8081/repository/maven-releases/
                '''
            }
        }
    }
}

Example 2: Cleanup Policies

# Create cleanup policy via API
curl -u admin:password -X POST \
  "http://your-server-ip:8081/service/rest/v1/cleanup-policies" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "cleanup-snapshots",
    "format": "maven2",
    "mode": "delete",
    "criteria": {
      "lastBlobUpdated": "30",
      "isPrerelease": "true"
    }
  }'

# Apply to repository
# Go to repository settings โ†’ Cleanup policies
# Select: cleanup-snapshots

Example 3: Repository Health Check

# Create scheduled task for health check
# Administration โ†’ System โ†’ Tasks โ†’ Create task
# Type: "Repository Health Check"
# Repository: maven-public
# Schedule: Daily at 2 AM

# Via REST API
curl -u admin:password \
  "http://your-server-ip:8081/service/rest/v1/repositories/maven-public/health-check"

๐Ÿšจ Fix Common Problems

Problem 1: Nexus Wonโ€™t Start

Symptom: Service fails or stuck starting ๐Ÿ˜ฐ

Fix:

# Check logs
sudo tail -n 100 /opt/nexus/sonatype-work/nexus3/log/nexus.log

# Common issue: Not enough memory
free -h
# Increase memory in nexus.vmoptions

# Check permissions
ls -la /opt/nexus/
# Should be owned by nexus user

# Manual start for debugging
sudo -u nexus /opt/nexus/nexus/bin/nexus run

# Check Java version
java -version
# Must be Java 8 or 11

Problem 2: Cannot Upload Artifacts

Symptom: 401 Unauthorized or 403 Forbidden ๐Ÿ”

Fix:

# Check credentials in settings.xml
cat ~/.m2/settings.xml

# Verify repository permissions
# Administration โ†’ Security โ†’ Users
# Check user has nx-repository-admin privilege

# Check deployment policy
# Repository settings โ†’ Deployment policy
# Should be "Allow redeploy" for snapshots

# Test with curl
curl -u admin:password \
  --upload-file myapp.jar \
  "http://your-server-ip:8081/repository/maven-releases/com/example/myapp/1.0/myapp-1.0.jar"

Problem 3: Disk Space Issues

Symptom: Storage full, uploads failing ๐Ÿ’พ

Fix:

# Check disk usage
df -h /opt/nexus

# Run cleanup task
# Administration โ†’ System โ†’ Tasks
# Run: "Admin - Compact blob store"

# Delete old snapshots
# Create cleanup policy (see Example 2)

# Move blob store to larger disk
sudo systemctl stop nexus
sudo mv /opt/nexus/sonatype-work/nexus3/blobs /new/location/
sudo ln -s /new/location/blobs /opt/nexus/sonatype-work/nexus3/blobs
sudo systemctl start nexus

๐Ÿ“‹ Simple Commands Summary

TaskCommand/LocationPurpose
Start Nexussudo systemctl start nexusStart service
Stop Nexussudo systemctl stop nexusStop service
View logstail -f /opt/nexus/sonatype-work/nexus3/log/nexus.logMonitor logs
Initial passwordcat /opt/nexus/sonatype-work/nexus3/admin.passwordFirst login
Browse reposBrowse โ†’ ComponentsView artifacts
Upload artifactUse Maven/npm/Docker clientDeploy artifacts
SearchSearch โ†’ ComponentsFind artifacts
TasksAdministration โ†’ System โ†’ TasksMaintenance
CleanupAdministration โ†’ Cleanup policiesSpace management

๐Ÿ’ก Tips for Success

๐Ÿš€ Performance Optimization

Make Nexus super fast:

# Increase JVM heap
sudo vi /opt/nexus/nexus/bin/nexus.vmoptions
# -Xms4g
# -Xmx4g
# -XX:MaxDirectMemorySize=6g

# Enable G1 garbage collector
# -XX:+UseG1GC
# -XX:MaxGCPauseMillis=200

# Database optimization
# Administration โ†’ System โ†’ Capabilities
# Create: "Datastore JDBC" capability
# Configure PostgreSQL for better performance

# Restart Nexus
sudo systemctl restart nexus

๐Ÿ”’ Security Best Practices

Keep Nexus secure:

  1. Enable HTTPS - Use SSL certificates! ๐Ÿ”
  2. LDAP Integration - Central authentication! ๐Ÿ‘ฅ
  3. Content Selectors - Fine-grained access! ๐Ÿ”‘
  4. Realms - Enable security features! ๐Ÿ›ก๏ธ
  5. Regular updates - Keep Nexus updated! ๐Ÿ“ฆ
# Setup HTTPS with reverse proxy
sudo dnf install -y nginx

cat << 'EOF' | sudo tee /etc/nginx/conf.d/nexus.conf
server {
    listen 443 ssl;
    server_name nexus.example.com;
    
    ssl_certificate /etc/ssl/certs/nexus.crt;
    ssl_certificate_key /etc/ssl/private/nexus.key;
    
    client_max_body_size 1G;
    
    location / {
        proxy_pass http://localhost:8081;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto "https";
    }
}
EOF

sudo systemctl restart nginx

๐Ÿ“Š Monitoring and Backup

Keep Nexus healthy:

# Backup script
cat << 'EOF' > /usr/local/bin/backup-nexus.sh
#!/bin/bash
BACKUP_DIR="/backup/nexus"
DATE=$(date +%Y%m%d)

mkdir -p $BACKUP_DIR

# Stop Nexus
sudo systemctl stop nexus

# Backup data
tar -czf $BACKUP_DIR/nexus-data-$DATE.tar.gz /opt/nexus/sonatype-work/nexus3

# Start Nexus
sudo systemctl start nexus

# Keep only last 7 backups
find $BACKUP_DIR -name "*.tar.gz" -mtime +7 -delete

echo "Backup completed!"
EOF

chmod +x /usr/local/bin/backup-nexus.sh
# Add to cron: 0 2 * * * /usr/local/bin/backup-nexus.sh

๐Ÿ† What You Learned

Youโ€™re now a Nexus Repository expert! ๐ŸŽ“ Youโ€™ve successfully:

  • โœ… Installed Nexus on AlmaLinux 9
  • โœ… Created multiple repository types
  • โœ… Configured Maven, npm, and Docker
  • โœ… Set up proxy repositories
  • โœ… Implemented cleanup policies
  • โœ… Integrated with CI/CD
  • โœ… Mastered artifact management

Your repository hub is production-ready! ๐Ÿ“ฆ

๐ŸŽฏ Why This Matters

Nexus transforms artifact management! With your repository manager, you can:

  • ๐Ÿ“ฆ Centralize everything - One source of truth!
  • ๐Ÿš€ Speed up builds - Local artifact caching!
  • ๐Ÿ”’ Control access - Who gets what artifacts!
  • ๐Ÿ“Š Track usage - Know whatโ€™s being used!
  • ๐Ÿ’ฐ Save bandwidth - Cache external dependencies!

Youโ€™re not just storing artifacts - youโ€™re creating a robust supply chain for your entire development process! Every dependency is managed, every artifact is tracked! ๐ŸŽญ

Keep building, keep managing, and remember - with Nexus, artifact chaos becomes organized bliss! โญ

May your builds be fast and your artifacts always available! ๐Ÿš€๐Ÿ“ฆ๐Ÿ™Œ