6

How To Install JFrog Artifactory on CentOS 7

 2 years ago
source link: https://computingforgeeks.com/how-to-install-jfrog-artifactory-on-centos/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
How To Install JFrog Artifactory on CentOS 7
Search

This guide will walk you through steps used to install JFrog Artifactory on CentOS 7. JFrog Artifactory is the world’s most advanced repository manager which fully supports software created in any language or using any tool.

JFrog Artifactory is designed to integrate with the majority of continuous integration and delivery tools to deliver an end to end automated solution for tracking artifacts from development to production. A number of open source plugins are available to give you an easy way to extend the capabilities of Artifactory and integrate with other tools. Examples are JenkinsTeamCityBambooMavenBower and Gradleand much more.

For Ubuntu, use: How to Install JFrog Artifactory on Ubuntu

There are different editions of JFrog Artifactory available, check the Comparison Matrix.

There two ways of installing Artifactory on CentOS 7:

  1. Using Docker
  2. Installing from RPM packages

Method 1: Install JFrog Artifactory using Docker

For Docker installation, here are the steps to use:

Step 1: Install Docker Engine

Install Docker using our previous guide: How to install Docker CE on Ubuntu / Debian / Fedora / Arch / CentOS

Step 2: Download JFrog Artifactory Docker image

Pull the latest Docker image of JFrog Artifactory.

docker pull docker.bintray.io/jfrog/artifactory-oss:latest

For CE edition:

docker pull docker.bintray.io/jfrog/artifactory-cpp-ce

Confirm Docker images:

$ docker images
REPOSITORY                                   TAG                 IMAGE ID            CREATED             SIZE
docker.bintray.io/jfrog/artifactory-cpp-ce   latest              24d943a892ac        43 hours ago        582MB
docker.bintray.io/jfrog/artifactory-oss      latest              58d49856785f        43 hours ago        582MB

Step 3: Create Data Directory

Create data directory on host system to ensure data used on container is persistent.

sudo mkdir -p /jfrog/artifactory
sudo chown -R 1030 /jfrog/

Step 4: Start JFrog Artifactory container

To start an Artifactory container, use the command:

docker run --name artifactory -d -p 8081:8081 -p 8082:8082 \
  -v /jfrog/artifactory:/var/opt/jfrog/artifactory \
  docker.bintray.io/jfrog/artifactory-oss:latest

You can pass Java system properties to the JVM running Artifactory using EXTRA_JAVA_OPTIONS. Check more on Docker setup link. See example below.

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

Use docker ps command to view container information.

Step 5: Running JFrog Artifactory container with Systemd

Systemd is the default init system for CentOS 7. We can use it to manage JFrog Artifactory container.

Create Artifactory service unit file.

sudo vim /etc/systemd/system/artifactory.service
[Unit]
Description=Setup Systemd script for Artifactory Container
After=network.target

[Service]
Restart=always
ExecStartPre=-/usr/bin/docker kill artifactory
ExecStartPre=-/usr/bin/docker rm artifactory
ExecStart=/usr/bin/docker run --name artifactory -p 8081:8081 -p 8082:8082 \
  -v /jfrog/artifactory:/var/opt/jfrog/artifactory \
  docker.bintray.io/jfrog/artifactory-oss:latest
ExecStop=-/usr/bin/docker kill artifactory
ExecStop=-/usr/bin/docker rm artifactory

[Install]
WantedBy=multi-user.target

Reload systemd.

sudo systemctl daemon-reload

Then start Artifactory container with systemd.

sudo systemctl start artifactory

Enable it to start at system boot.

sudo systemctl enable artifactory

Status can be checked with:

systemctl status artifactory

Sample output:

Also check service binding with:

ss -tunelp | grep 8081

Step 6: Access Artifactory Web Interface

Artifactory can be accessed using the following URL:

http://SERVERIP_OR_DOMAIN:8081/artifactory

Follow setup instructions that follows.

Select the package type(s) you want to create default repositories for.

You can skip to set later.

Click “Finish” button to complete installation.

Step 7: Configure Nginx reverse proxy (Optional)

If you want to use Nginx as Proxy with SSL, check out the guide below:

Method 2: Install JFrog Artifactory using RPM

Here are the steps you need to install JFrog Artifactory on CentOS 7 from RPM packages.

Step 1: Install Java

Use the commands below to install Java on CentOS:

sudo yum -y install java-1.8.0-openjdk  java-1.8.0-openjdk-devel
sudo alternatives --config java
java -version

Step 2: Set JAVA_HOME

After installing Java, Set JAVA_HOME environment variable.

Step 3: Install and Configure Database Server

Install MariaDB Database Server:

Step 4: Add JFrog Artifactory RPM repository

The JFrog Artifactory packages are available on official repository. Add it by running:

curl -sL https://bintray.com/jfrog/artifactory-rpms/rpm | sudo tee /etc/yum.repos.d/bintray-jfrog-artifactory-rpms.repo

This repository works for both Artifactory CE and Artifactory OSS editions.

Step 5: Install JFrog Artifactory on CentOS 7

Installing JFrog Artifactory is a matter of running yum command and specifying Artifactory edition to install.

Install JFrog Artifactory OSS:

sudo yum -y install jfrog-artifactory-oss wget

Install JFrog Artifactory CE:

sudo yum -y install jfrog-artifactory-cpp-ce wget 

Set ARTIFACTORY_HOME.

echo "export ARTIFACTORY_HOME=/opt/jfrog/artifactory" | sudo tee -a /etc/profile
source /etc/profile
env | grep ARTIFACTORY_HOME

Files and Folders Locations:

When installed from an RPM distribution, Artifactory retains the FHS (Filesystem Hierarchy Standard) format:

File/FolderLocationOwnershipTomcat home/opt/jfrog/artifactory/tomcatartifactory  (root for sub dirs)Artifactory startup script/etc/init.d/artifactoryrootArtifactory logs/var/opt/jfrog/artifactory/logsartifactoryArtifactory home/var/opt/jfrog/artifactoryartifactory Artifactory etc/etc/opt/jfrog/artifactoryartifactory Artifactory env variables/etc/opt/jfrog/artifactory/defaultartifactory Artifactory binary/opt/jfrog/artifactoryroot 

Step 6: Configuring Artifactory to use MariaDB

1. Copy Artifactory database configuration template.

sudo mkdir /var/opt/jfrog/artifactory/etc
sudo cp /opt/jfrog/artifactory/misc/db/mariadb.properties /var/opt/jfrog/artifactory/etc/db.properties

2. Run MariaDB configuration script.

sudo /opt/jfrog/artifactory/bin/configure.mysql.sh

Provide root password and set Artifactory user password then Agree to download Artifactory.

########################################################
# Welcome to the Artifactory MySQL configuration tool! #
########################################################

Please enter the MySQL server admin username [root]: <Enter root password>

Please enter the MySQL server admin password: <Set ArtifactoryAdminPassoword>
Please enter the Artifactory database username [artifactory]: 

Please enter the Artifactory database password [password]: 
Creating the Artifactory MySQL user and database...

No MySQL JDBC connector found. Download or copy one needed.
Does the current server has access to the Internet? [Y/n] y

Downloading mysql-connector-java-5.1.24.jar to /opt/jfrog/artifactory/tomcat/lib...

Configuration completed successfully!
You can now start up the Artifactory service to use Artifactory with MySQL.
Press enter to exit...

Start Artifactory service:

sudo systemctl start artifactory.service
sudo systemctl enable artifactory.service

Check service status:

$ systemctl status  artifactory.service
 ● artifactory.service - Setup Systemd script for Artifactory in Tomcat Servlet Engine
    Loaded: loaded (/usr/lib/systemd/system/artifactory.service; enabled; vendor preset: disabled)
    Active: active (running) since Wed 2019-04-10 10:31:16 CEST; 36s ago
   Process: 5091 ExecStop=/opt/jfrog/artifactory/bin/artifactoryManage.sh stop (code=exited, status=0/SUCCESS)
   Process: 5164 ExecStart=/opt/jfrog/artifactory/bin/artifactoryManage.sh start (code=exited, status=0/SUCCESS)
  Main PID: 5213 (java)
    CGroup: /system.slice/artifactory.service
            ‣ 5213 /usr/bin/java -Djava.util.logging.config.file=/opt/jfrog/artifactory/tomcat/conf/logging.properties -Djava.util.logging.manager=or…
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + runReplicator
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + '[' '' == true ']'
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + return 1
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + startMetadata
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + runMetadata
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + '[' '' == true ']'
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + return 1
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + '[' 0=0 ']'
 Apr 10 10:31:16 artifactory artifactoryManage.sh[5164]: + exit 0
 Apr 10 10:31:16 artifactory systemd[1]: Started Setup Systemd script for Artifactory in Tomcat Servlet Engine.

Step 7: Access Artifactory Web Interface

Artifactory can be accessed using the following URL:

http://SERVERIP_OR_DOMAIN:8081/artifactory

You should see Artifactory welcome page.

Check Artifactory Documentation for more features and usage guides.

Check out Available books on Amazon:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK