Share on Social Media

In this configuration guide, you will learn, how to install JFrog Artifactory on CentOS 7 or other Redhat based Linux OS. #centlinux #linux #devops

What is JFrog Artifactory? :

Artifactory is a universal repository manager created by JFrog. A repository manager is software application designed to manage binary components related to an application. Being a universal repository manager, Artifactory supports all major packaging formats like Apache Maven, Gradle, Docker and many more.

In DevOps environments, Artifactory is used by build tools such as Apache Ant, Maven and Gradle to serve as the local repository for their respective artifacts. Although using Artifactory is not mandatory in DevOps environment, but it can be used to accelerate the CI/CD process.

JFrog Artifactory is a commercial product. However, there is an OSS (Open Source Software) version is available with limited features. We will use this OSS version in our article. We will install JFrog Artifactory on CentOS 7 and deploy and use MariaDB database as the backend database for Artifactory.

For more information on DevOps best practices and CI/CD implementation, please read Continuous Delivery for Java Apps (PAID LINK) by Leanpub.

System Specification:

We have used a CentOS 7 virtual machine with following specification for this article.

  • Hostname – artifactory-01.example.com
  • IP Address – 192.168.116.130/24
  • Operating System – CentOS 7.6

Install Java Development Kit on CentOS 7:

JFrog Artifactory requires Java Development Kit (JDK) 8 update 45 or above.

In CentOS 7, the OpenJDK (an open-source Java Development Kit) can be installed using yum command. However, if you are using a Red Hat Enterprise Linux (RHEL) 7 then you have to configure a Local yum Repository and then you will be able to install OpenJDK using yum command.

# yum install -y java-1.8.0-openjdk-devel

Since, our server is minimal installed, therefore, yum has installed various dependent packages along with OpenJDK.

Set JAVA_HOME environment variable.

# echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64" >> /etc/profile
# . /etc/profile
# env | grep JAVA
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64

OpenJDK has been installed on CentOS 7.

Install JFrog Artifactory on CentOS 7:

Install preqrequisite packages using yum command.

# yum install -y net-tools rsync

Download latest JFrog Artifactory OSS RPM and copy it to the home directory of root user.

By using yum command, install Jfrog Artifactory on CentOS 7.

# yum install -y jfrog-artifactory-oss-6.6.5.rpm

Set ARTIFACTORY_HOME environment variable.

# echo "export ARTIFACTORY_HOME=/opt/jfrog/artifactory" >> /etc/profile
# . /etc/profile
# env | grep ARTIFACTORY_HOME
ARTIFACTORY_HOME=/opt/jfrog/artifactory

JFrog Artifactory has been installed on CentOS 7.

Install MariaDB Database on CentOS 7:

It is recommended to install JFrog Artifactory on CentOS 7 with an external database. Being a hardcore FOSS (Fan of Open Source Software), we selected MariaDB Database for this purpose.

Install MariaDB Server from CentOS yum repository.

# yum install -y mariadb-server

Start and Enable MariaDB Service.

# systemctl start mariadb.service
# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

Configure MariaDB database instance as follows.

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Create JFrog Artifactory Database:

Create and configure Artifactory database.

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

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

Stopping the Artifactory service...

Please enter the MySQL server admin username [root]:

Please enter the MySQL server admin password:
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...

There is a known issue with PIDs in new versions of systemd, due to the more restricted handling of PID files by systemd. Therefore, you may encounter some PIDs error while starting artifactory.service.

# systemctl start artifactory.service
Job for artifactory.service failed because the control process exited with error code. See "systemctl status artifactory.service" and "journalctl -xe" for details.

Artifactory service is not started, we need to edit service file to rectify this problem.

Edit artifactory.service and add the user and group who own the service.

# vi /lib/systemd/system/artifactory.service

Add following directives under the [service] section.

User=artifactory
Group=artifactory

Set open file limits for the artifactory user.

# echo "artifactory soft nofile 32000" >> /etc/security/limits.conf
# echo "artifactory hard nofile 32000" >> /etc/security/limits.conf

Now edit the artifactoryManage.sh script.

# vi /opt/jfrog/artifactory/bin/artifactoryManage.sh

Find and replace the following 4 lines of code with the given code (Find yellow code and replace it with green code).

#su -s "/bin/sh" ${ARTIFACTORY_USER} -c "${replicatorScript} start"
${replicatorScript} start

#su -s "/bin/sh" ${ARTIFACTORY_USER} -c "${replicatorScript} stop"
${replicatorScript} stop

#su -s "/bin/sh" ${ARTIFACTORY_USER} -c "export JAVA_HOME='$JAVA_HOME'; $TOMCAT_HOME/bin/startup.sh"
$TOMCAT_HOME/bin/startup.sh

#su -s "/bin/sh" ${ARTIFACTORY_USER} -c "export JAVA_HOME='$JAVA_HOME'; $TOMCAT_HOME/bin/shutdown.sh"
$TOMCAT_HOME/bin/shutdown.sh

Start and enable Artifactory service.

# systemctl start artifactory.service
# systemctl enable artifactory.service
Created symlink from /etc/systemd/system/multi-user.target.wants/artifactory.service to /usr/lib/systemd/system/artifactory.service.

Artifactory service has been started successfully.

Configure Linux Firewall:

Now allow Artifactory service port to make it accessible from the network.

# firewall-cmd --permanent --add-port=8081/tcp
success
# firewall-cmd --reload
success

Configure JFrog Artifactory:

Browse URL http://artifactory-01.example.com:8081 from a client browser.

jfrog-artifactory-webui-welcome-01

Click on Next.

jfrog-artifactory-webui-set-admin-password-02

Set the password for default admin user of Artifactory and click on Next.

jfrog-artifactory-webui-configure-proxy-03

If this server access the Internet through a proxy, then configure it here or click on Skip.

create repositories

Select the package types for which you want to create repositories. The default repositories for the selected package types will be created by the Artifactory. Or click on Skip.

artifactory on-boarding complete

The initial configuration of Artifactory has been completed. Click on Finish.

artifactory dashboard

You have reached at the Dashboard of JFrog Artifactory Web UI. This dashboard is enriched with links to guides and documentation related to JFrog Artifactory. You can browse these links and start using JFrog Artifactory accordingly.

Conclusion:

In this configuration guide, you will learn, how to install JFrog Artifactory on CentOS 7 or other Redhat based Linux OS.

6 thoughts on “How to install JFrog Artifactory on CentOS 7”
  1. Hi Dear,

    According to your blog, I have created setup but I have found issues in it, Please suggest me. for your reference I have append below logs of Artifactory server.

    Logs:

    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    … 105 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessJdbcHelperImpl': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Could not initialize database: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:ParallelWebappClassLoader
    context: access
    delegate: false
    ———-> Parent Classloader:
    java.net.URLClassLoader@3a71f4dd
    ;ClassLoader:ParallelWebappClassLoader
    context: access
    delegate: false
    ———-> Parent Classloader:
    java.net.URLClassLoader@3a71f4dd

  2. Hi Ashish,

    Thanks for using my article.

    Although, the given log isn't enough to pin-point the actual problem. But, I have intuition that the problem is somehow related to MySQL Java connector. Therefore, I suggest you to repeat step /opt/jfrog/artifactory/bin/configure.mysql.sh again and check.

Leave a Reply