Skip to content

Instantly share code, notes, and snippets.

@tsuyo
Last active April 11, 2020 10:57
Show Gist options
  • Save tsuyo/e62615d7c1a1a84292c9642088875a5f to your computer and use it in GitHub Desktop.
Save tsuyo/e62615d7c1a1a84292c9642088875a5f to your computer and use it in GitHub Desktop.
JFrog Artifactory Installation and Setup

Standalone on Mac / Linux (tested on Mac)

Download Artifactory or Download Artifactory from Bintray

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home
$ export JFROG_HOME=/opt/jfrog
$ tar -C $JFROG_HOME -zxvf jfrog-artifactory-pro-7.2.1-darwin.tar.gz
$ ln -s /opt/jfrog/artifactory-pro-7.2.1 $JFROG_HOME/artifactory-pro
$ $JFROG_HOME/artifactory-pro/app/bin/artifactoryctl start

Now you can access the JFrog instance with http://localhost:8081/ (admin/password)

Docker on Mac / Linux (tested on Ubuntu)

Installing with Docker

$ mkdir -p ~/.jfrog/artifactory/var
$ docker run --rm --name artifactory -v ~/.jfrog/artifactory/var:/var/opt/jfrog/artifactory -d -p 8081:8081 -p 8082:8082 -e EXTRA_JAVA_OPTIONS='-Xms512m -Xmx2g -Xss256k -XX:+UseG1GC' docker.bintray.io/jfrog/artifactory-pro:latest

Docker Compose with MySQL on Ubuntu

$ tar zxvf jfrog-artifactory-pro-7.3.2-compose.tar.gz
$ cd artifactory-pro-7.3.2
$ sudo ./config.sh
...
Installation Directory (Default: /home/ubuntu/.jfrog/artifactory):<Return>
...
Are you adding an additional node to an existing product cluster? [y/N]:<Return>
...
Please specify the IP address of this machine (Default: 10.0.1.194):<Return>
...
Are you adding an additional node to an existing product cluster? [y/N]:<Return>
...
Do you want to install PostgreSQL? [Y/n]:n
...
PostgreSQL url. Example: [jdbc:postgresql://<IP_ADDRESS>:<PORT>/artifactory]: jdbc:postgresql://localhost/artifactory # Due to a bug, you have to put a string starting with "jdbc:postgresql" - will modify this later

PostgreSQL username (If your existing connection URL already includes the username, leave this empty): artifactory

PostgreSQL password (If your existing connection URL already includes the password, leave this empty): password
...

This creates .env, docker-compose.yaml and ~/.jfrog/artifactory.

Next, you have to prepare for MySQL and modify ~/.jfrog/artifactory accordingly.

$ mysql -h <mysql_host> -P <mysql_password> -u admin -p
mysql> CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
mysql> CREATE USER 'artifactory'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL on artdb.* TO 'artifactory'@'%';
mysql> FLUSH PRIVILEGES;

$ sudo chmod -R 777 $JFROG_HOME/artifactory
$ vi ~/.jfrog/artifactory/var/etc/system.yaml
shared:
...
  database:
    type: mysql
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://<mysql_host>:<mysql_port>/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=false
    username: artifactory
    password: password
...
$ cp mysql-connector-java-5.1.48.jar .jfrog/artifactory.20200403/var/bootstrap/artifactory/tomcat/lib/
$ sudo docker-compose -p rt up -d
$ sudo docker-compose -p rt logs -f

Set up your first VM (on AWS)

Create a VM

  • Region: us-west-2
  • Launch instance
    • Step 1: Ubuntu Server 18.04 LTS (HVM), SSD Volume Type - ami-06d51e91cea0dac8d (64-bit x86)
    • Step 2: m5.xlarge
    • Step 3: Network: tsuyo_vpc, Subnet: 10.0.1.0 - us-west-2a
    • Step 4: Size: 100 (GiB)
    • Step 5: Name=artifactory
    • Step 6: tsuyo-artifactory
    • key pair: XXX

VM setup

$ ssh -i XXX ubuntu@XXX
$ sudo apt update
$ sudo apt install -y openssl curl maven git docker.io python-pip rubygems nodejs npm nuget openssh-server vim default-jdk
$ npm install bower

Jenkins

$ wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
$ sudo apt update
$ sudo apt install jenkins

And etc...

$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
$ sudo apt install git-lfs
$ pip install conan

reverse-proxy

$ sudo apt install -y nginx apache2
$ sudo service nginx stop
$ sudo service apache2 stop

Artifactory

$ wget -q -O - https://bintray.com/user/downloadSubjectPublicKey?username=jfrog | sudo apt-key add -
$ echo "deb https://jfrog.bintray.com/artifactory-pro-debs bionic main" | sudo tee -a /etc/apt/sources.list.d/jfrog-artifactory-pro.list
$ sudo apt update
$ sudo apt install -y jfrog-artifactory-pro
$ sudo systemctl start artifactory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment