Installing on Un*x

Skip to end of metadata
Go to start of metadata
Table of Contents

Unix

When using Unix, it is possible to install Artifactory as a Unix service or run it manually.
Before you install is recommended you first verify your current environment by running artifactoryctl check under the $ARTIFACTORY_HOME/bin folder (this script is, in fact, a customized Jetty init script).

Installing Artifactory as Linux Service

Introduction

Artifactory is packaged with a complete install script that can be used to install it as a Unix service running under a custom user and using the standard Unix directories.

Installing

To setup Artifactory correctly as a Linux service run, as root, the $ARTIFACTORY_HOME/bin/install.sh script.

Here is the main information about what this script is doing:

User creation

Creates a user named "artifactory" ($ARTIFACTORY_USER) by default. You can change the default user by editing the $ARTIFACTORY_USER value in /etc/artifactory/default. The install script accepts the user name as its first and only parameter.

etc config

Creates the folder /etc/artifactory, copies the configuration files there and creates a soft link in $ARTIFACTORY_HOME/etc

etc default

Creates the file /etc/artifactory/default that contains the main environment variables needed for artifactory to run: JAVA_HOME, ARTIFACTORY_USER, ARTIFACTORY_HOME, JAVA_OPTIONS,...
The /etc/artifactory/default is included at the top of artifactoryctl and so can include whatever you wish.
NOTE: The default max memory is 1GB

init.d

It copies the file artifactoryctl to /etc/init.d/artifactory

Logs folder

Creates /var/log/artifactory folder, makes it writable for the user ARTIFACTORY_USER and creates a soft link $ARTIFACTORY_HOME/logs.

Backup folder

Creates the folder $ARTIFACTORY_HOME/backup, so you will need to create a link if you wish this folder to point to somewhere else (like /var/backup/artifactory for example). The script makes $ARTIFACTORY_HOME/backup writable for the user ARTIFACTORY_USER.

Data folder

Create the folder $ARTIFACTORY_HOME/data, so you will need to create a link if you wish this folder to point to somewhere else. The script will make it writable for the user ARTIFACTORY_USER.

chkconfig calls

The script calls add, list (you can see the output), then activate the Artifactory service

After running the script successfully you can test the installation by running: service artifactory check or /etc/init.d/artifactory check

And if everything is OK, start artifactory with:

or

You can then check the Artifactory log with:

Normally Artifactory will be started as root (when running as a service) and will su internally to the $ARTIFACTORY_USER user. If the $ARTIFACTORY_USER is undefined Artifactory will run as the current user, which is not recommended, especially if the current user is root, due to security considerations.

Running Artifactory Manually on Unix

You can run artifactory manually with artifactory.sh directly to see its behavior. The console will be locked on artifactory process and you can stop it cleanly with crtl+c.

You can also try executing

to directly run Artifactory as a daemon process, using the environment variable of the shell you are currently in.

Labels:
  1. Sep 05, 2009

    If you're using Gentoo Linux or anything with a similar set of startup tools (start-stop-daemon, runscript, ebegin, eend, etc.) I cooked up this script which works nicely with this environment:

    Before installing, I logged in as root and ran useradd to create a user called artifact then whipped up a wrapper script to invoke Artifactory's install.sh (from the Artifactory .zip download) which set the necessary environment variables:

    Then I registered the script to invoke itself in the default run level:

    Without needing to reboot I then started the script:

    Then it should show up in ps:

  2. Dec 10, 2010

    On Ubuntu (9.10) JAVA_HOME settings in the "/etc/environment" file did not propagate to the service call (you must set the variable in "/etc/artifactory/default" (this is a Linux-?-Ubuntu issue).

    Second, the service would appear to start (launching Jetty), but no web app. Here are two solutions: edit "/etc/init.d/artifactory" to run the service as "root" OR (what I did), in your Artifactory program directory, change the owner (of everything) to "artifactory" ("chown -R -L -v  artifactory ."). This second method will ALSO fail if you symlink your "data" directory to another location (so don't do that! ... probably something weird on my end...), Good luck!

  3. Apr 30, 2011

    I've made some modifications to the install and init scripts to allow them to work on "Unix" (only tested on Solaris 10) as implied by this site title.

    I have not changed the message about chkconfig but added simple links to start enable start script in runlevel 3.

    For the init script one needs to basically change sh to bash, or /usr/bin/env bash, to get the bashims to work since sh is not bash on Solaris.
    Then one has to change the su lines to:

    //

  4. Feb 09, 2012

    A R

    Hello,

    I need some help installing artifactory as a unix service on redhat.

    I acquired the jar as follows and tried to install it but got errors. Can anyone please help me? I checked and user artifactory was not created but the group artifactory was created.

    1. Make sure Java was installed and JAVA_HOME was set:

    #echo $JAVA_HOME
    /usr/java/jdk1.6.0_27

    2. Acquired the latest download and ran the install. ( I see now that I did not install it as /opt/artifactory/install.sh)

    #cd /opt

    #wget http://sourceforge.net/projects/artifactory/files/artifactory/2.5.0/artifactory-2.5.0.zip/download
    # unzip artifactory-2.5.0.zip
    #cd artifactory-2.5.0/bin
    # ./install.sh

    Installing artifactory as a Unix service that will run as user artifactory

    Installing artifactory with home /opt/artifactory-2.5.0
    Creating user artifactory...id: artifactory: No such user
    creating...useradd: group artifactory exists - if you want to add this user to that group, use -g.
    Checking configuration link and files in /etc/artifactory...
    Moving configuration dir etc to etc.original\033[32mDONE\033[0m
    creating dir /etc/artifactory...creating the link and updating dir...\033[32mDONE\033[0m
    Creating environment file /etc/artifactory/default...creating...\033[32mDONE\033[0m
    ** INFO: Please edit the files in /etc/artifactory to set the correct environment
    Especially /etc/artifactory/default that defines ARTIFACTORY_HOME, JAVA_HOME and JAVA_OPTIONS

    Creating link /opt/artifactory-2.5.0/logs to /var/log/artifactory...creating...\033[32mDONE\033[0m

    Setting file permissions to etc, logs, work, data and backup...chown: `artifactory': invalid user\033[31m** ERROR\033[0m