在 CentOS 7 上安装 MariaDB 数据库:

建议将 JFrog Artifactory 与外部数据库一起使用。

从 CentOS yum 存储库安装 MariaDB 服务器。

[root@artifactory-01 ~]# yum install -y mariadb-server

启动并启用 MariaDB 服务。

[root@artifactory-01 ~]# systemctl start mariadb.service
[root@artifactory-01 ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

如下配置 MariaDB 数据库实例。

[root@artifactory-01 ~]# 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!

创建和配置 Artifactory 数据库。

[root@artifactory-01 ~]# /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...
[root@artifactory-01 ~]#

由于 systemd 对 PID 文件的处理受到更多限制,因此新版本 systemd 中的 PID 存在一个已知问题。
因此,我们在启动 artifactory.service 时可能会遇到一些 PID 错误。

[root@artifactory-01 ~]# 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 并添加拥有该服务的用户和组。

[root@artifactory-01 ~]# vi /lib/systemd/system/artifactory.service

在 [service] 部分下添加以下指令。

User=artifactory
Group=artifactory

为 artifactory 用户设置打开文件限制。

[root@artifactory-01 ~]# echo "artifactory soft nofile 32000" >> /etc/security/limits.conf
[root@artifactory-01 ~]# echo "artifactory hard nofile 32000" >> /etc/security/limits.conf

现在编辑 artifactoryManage.sh 脚本。

[root@artifactory-01 ~]# vi /opt/jfrog/artifactory/bin/artifactoryManage.sh

找到并用给定的代码替换以下 4 行代码(找到黄色代码并用绿色代码替换)。

#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

启动并启用 Artifactory 服务。

[root@artifactory-01 ~]# systemctl start artifactory.service
[root@artifactory-01 ~]# systemctl enable artifactory.service
Created symlink from /etc/systemd/system/multi-user.target.wants/artifactory.service to /usr/lib/systemd/system/artifactory.service.

Artifactory 服务已成功启动。

现在允许Artifactory 服务端口使其可从网络访问。

[root@artifactory-01 ~]# firewall-cmd --permanent --add-port=8081/tcp
success
[root@artifactory-01 ~]# firewall-cmd --reload
success

访问Artifactory:

http://artifactory-01.onitroad.com:8081.

单击下一步。

为 Artifactory 的默认管理员用户设置密码,然后单击下一步。

如果此服务器通过代理访问 Internet,则在此处进行配置或者单击跳过。

选择要为其创建存储库的包类型。
所选包类型的默认存储库将由 Artifactory 创建。
或者点击跳过。

Artifactory 的初始配置已经完成。

在 CentOS 7 上安装 Java 开发工具包

JFrog Artifactory 需要 Java 开发工具包 (JDK) 8 更新 45 或者更高版本。

[root@artifactory-01 ~]# yum install -y java-1.8.0-openjdk-devel

设置 JAVA_HOME 环境变量。

[root@artifactory-01 ~]# echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64" >> /etc/profile
[root@artifactory-01 ~]# . /etc/profile
[root@artifactory-01 ~]# env | grep JAVA
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
如何在 CentOS/RHEL 7 上安装 JFrog Artifactory
https://onitroad.com 更多教程

在 CentOS 7 上安装 JFrog Artifactory OSS:

使用 yum 命令安装准备工作包。

[root@artifactory-01 ~]# yum install -y net-tools rsync

下载最新的 JFrog Artifactory OSS RPM 并将其复制到 root 用户的主目录。

安装 Jfrog Artifactory RPM。

[root@artifactory-01 ~]# yum install -y jfrog-artifactory-oss-6.6.5.rpm

设置 ARTIFACTORY_HOME 环境变量。

[root@artifactory-01 ~]# echo "export ARTIFACTORY_HOME=/opt/jfrog/artifactory" >> /etc/profile
[root@artifactory-01 ~]# . /etc/profile
[root@artifactory-01 ~]# env | grep ARTIFACTORY_HOME
ARTIFACTORY_HOME=/opt/jfrog/artifactory
日期:2020-09-17 00:10:56 来源:oir作者:oir