Archiva vs. Competitors: Which Archiving Tool Wins?

How to Set Up Archiva: Step-by-Step Tutorial

This tutorial walks you through a straightforward installation and initial configuration of Apache Archiva, a repository management tool for building and managing Maven artifacts. Assumptions: you’re using a modern Linux distribution (Ubuntu 20.04+ or CentOS ⁄8) and have sudo access. Commands use bash.

1. System prerequisites

  • Java: Archiva requires Java (OpenJDK 11+ recommended).
  • Ports: Default web UI runs on port 8080. Ensure it’s free or adjust configuration.
  • User: We’ll create a dedicated system user for Archiva.

Install Java and create a user (Ubuntu):

bash

sudo apt update sudo apt install -y openjdk-11-jre-headless wget unzip sudo useradd -r -s /bin/false archiva

2. Download Archiva

Find the latest Apache Archiva binary release (this tutorial uses a generic download method). From the Archiva download page copy the link to the binary (tar.gz). Example:

bash

cd /opt sudo wget https://downloads.apache.org/archiva/2.2.5/binaries/apache-archiva-2.2.5-bin.tar.gz sudo tar xzf apache-archiva-2.2.5-bin.tar.gz sudo mv apache-archiva-2.2.5 archiva sudo chown -R archiva:archiva /opt/archiva

Adjust the version in URLs and filenames to the current release.

3. Configure environment and runtime

Create a simple systemd service so Archiva runs as the archiva user and starts on boot.

Create /etc/systemd/system/archiva.service:

ini

[Unit] Description=Apache Archiva After=network.target [Service] Type=simple User=archiva Group=archiva Environment=JAVAHOME=/usr/lib/jvm/java-11-openjdk-amd64 WorkingDirectory=/opt/archiva ExecStart=/opt/archiva/bin/archiva console Restart=on-failure [Install] WantedBy=multi-user.target

Reload systemd and start:

bash

sudo systemctl daemon-reload sudo systemctl enable –now archiva sudo journalctl -u archiva -f

4. Initial web-based setup

  • Open your browser to http://your-server-ip:8080/archiva
  • The first-run wizard lets you set the admin user and password and configure repositories. Create an admin account and record credentials securely.

5. Create and configure repositories

Inside the Archiva web UI:

  1. Login as admin.
  2. Go to Repositories → Managed Repositories → Add Managed Repository.
    • Name: e.g., internal-releases
    • Location: default local storage path or custom directory (ensure archiva user has write access).
    • Layout: maven2
  3. Repeat for snapshots or proxy repositories.
  4. To proxy external repositories, use Remote Repositories → Add Remote Repository and set the URL (e.g., https://repo1.maven.org/maven2/).

Set repository scanning and cron schedules under Administration → Indexing.

6. Configure authentication and authorization

  • Use Users & Roles in the UI to add users and assign them roles (e.g., repository admin, deployer).
  • For enterprise setups, enable LDAP under Authentication/Authorization and provide LDAP server details.

7. Configure Maven clients to use Archiva

Comments

Leave a Reply