Install Artifactory OSS private maven repository

Carvia Tech | March 12, 2018 | 2 min read | 468 views


JFrog’s Artifactory open source project was created to speed up development cycles using binary repositories. It’s the world’s most advanced repository manager, creating a single place for teams to manage all their binary artifacts efficiently.

JFrog Artifactory OSS

Artifactory OSS can be very helpful tool when you want to host your own private maven repository for sharing common code within company premises.

private hosted repository

Installation on Ubuntu 16.04

gpg --keyserver pgpkeys.mit.edu --recv-key 6B219DCCD7639232
gpg -a --export 6B219DCCD7639232 | sudo apt-key add -
sudo apt-get update
sudo dpkg -i jfrog-artifactory-oss-5.8.3.deb
cd /opt/jfrog/artifactory/bin/
sudo ./configure.mysql.sh
Set Proper Permissions in Mysql
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX on artdb.* TO 'artifactory'@'localhost' IDENTIFIED BY 'password';
flush priviledges;
Manage Service for Artifactory
systemctl enable artifactory.service
systemctl start artifactory.service
systemctl stop artifactory.service
Uninstall Artifactory OSS
sudo apt-get remove jfrog-artifactory-oss

Create User, User Group and Permissions

Using Artifactory in your Gradle Project

gradle.properties
artifactory_user=${security.getCurrentUsername()}
artifactory_password=${security.getEncryptedPassword()!"AP9vEVsG9KunZzo6w7P1xwUhxBx"}
artifactory_contextUrl=http://oss.shunyafoundation.com/artifactory
build.gradle [Top Level]
buildscript {
    repositories {
        maven {
            url 'http://oss.shunyafoundation.com/artifactory/libs-release'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }

    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-snapshot-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
    resolve {
        repository {
            repoKey = 'libs-snapshot'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
}

Publishing Artifacts from common module to OSS

A shared library can be published to Artifactory OSS so that the other microservices/projects can start using this versioned library using maven dependency.

We can easily configure an artifact to publish it onto OSS.

apply plugin: "com.jfrog.artifactory"

version = '0.0.1-SNAPSHOT'
group = 'com.shunya'

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            repoKey = 'libs-snapshot-local'
            username = "${artifactory_username}"
            password = "${artifactory_password}"
            maven = true
        }
        defaults {
            publications ('mavenJava')
        }
    }
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}

Upgrade Artifactory to Latest Version

sudo systemctl stop artifactory.service

wget https://bintray.com/artifact/download/jfrog/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-5.9.0.deb
sudo dpkg -i jfrog-artifactory-oss-5.9.0.deb

sudo systemctl start artifactory.service

Top articles in this category:
  1. Installing nginx on macOS Mojave using brew
  2. Install and upgrade Jenkins on Ubuntu 18.04 LTS
  3. DevOps interview questions - Basic Concepts, Microservices, Databases, AWS
  4. Difference between Forward Proxy and Reverse Proxy Server
  5. Basic Unix commands for every programmer



Find more on this topic:
Dev Ops image
Dev Ops

Dev Ops Automation - Ubuntu OS, Centos, MySql, MongoDB, Java, AWS Infrastructure.

Last updated 1 week ago


Recommended books for interview preparation:

This website uses cookies to ensure you get the best experience on our website. more info