我们使用免费的CE进行搭建。
1.下载
链接:https://conan.io/downloads.html
2.安装
参考:https://www.jfrog.com/confluence/
https://www.jfrog.com/confluence/display/JFROG/Installing+Artifactory
note:
1.下载的jfrog-artifactory-cpp-ce-7.49.6-linux.tar.gz,解压之后在修改文件夹名字,artifactory-cpp-ce-7.49.6改为artifactory ,之后进入artifactory\app\bin目录下,执行./artifactoryctl start,
note:sudo的方式运行,可以解决前台进程运行的权限问题的报错。
需要将$JFROG_HOME/var/etc/system.basic-template.yaml 内容拷贝到system.yaml,主要是缺失这个文件,直接拷贝模板。以上就两个步骤 可以运行起来,web可以看到
如果以服务的方式运行
以服务方式运行的时候,需要注意,最好将压缩包解压在/opt下面,比如/opt/jfrog/artifactory
之后执行sudo ./artifactory/app/bin/installService.sh [artifactory [artifactory]]
最后执行systemctl start artifactory.service
会出现如下打印:
如果碰到错误
则按照提示进行设置,之后重启服务即可。
2.关闭防火墙,执行sudo ufw disable
3.访问地址是 http://SERVER_ HOSTNAME :8082/ui/
4.运行之前最好是配置一下(目前是采用的默认的配置文件,没有更改artifactory-cpp-ce-7.49.6/var/etc/system.yaml)
参考https://www.jfrog.com/confluence/display/JFROG/System+Configuration ,尤其是数据库配置https://www.jfrog.com/confluence/display/JFROG/Configuring+the+Database
暂时选择mysql,参考https://www.jfrog.com/confluence/display/JFROG/MySQL
创建mysql:
进入mysql,执行sudo mysql -uroot -p,设置了密码123456
运行sql脚本,执行source /opt/jfrog/artifactory/app/misc/db/createdb_mysql.sql,脚本内容如下:
CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'artifactory'@'%' IDENTIFIED BY 'password';
GRANT ALL on artdb.* TO 'artifactory'@'%';
FLUSH PRIVILEGES;
可见database名字是artdb,并且新建了用户artifactory以及密码试password
退出mysql,执行exit
配置artifactory使用mysql:
下载 MySQL JDBC driver,https://dev.mysql.com/downloads/connector/j/ ,可以选择No thanks, just start my download
Download the MySQL JDBC driver (available from the MySQL website ).Select the option P latform Independent option in the Select Operating System drop-down list and click Download next to the tar.gz or zip option, and unarchive it to get the jar file. You can choose to register or log in, or click No thanks, just start my download to download the file.
Copy themysql-connector-j-<version>.jarfile into $JFROG_HOME/artifactory/var/bootstrap/artifactory/tomcat/lib directory.------>这段很重要,如果没有dir,自行创建
Permissions
Make sure your driver has the same permissions as the rest of the files in the$JFROG_HOME/artifactory/vardirectory.
Adjust the database connection details in thesystem.yaml.configuration file .For example
shared:
database:
type:mysql
driver:com.mysql.jdbc.Driver
url:jdbc:mysql://<your db url,for example:localhost:3306>/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=false
username:artifactory
password:password
我本地的修改如下:
database:type: mysqldriver: com.mysql.jdbc.Driverurl: jdbc: mysql://192.168.60.207:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=falseusername: artifactorypassword: cb9278.aesgcm256.4kBG7GnycKsa0nMZ0I_vbYZQGQisG-NERxzvkaJm6ZLAedga(这里原先是password,后自动被加密了)
请参考 https://www.jfrog.com/confluence/display/RTF20/Running+Artifactory+on+MySQL ,主要参考 ----→这段很重要
有时候碰到报错Database ping failed with error dial tcp 192.168.60.207:3306: connect: connection refused,需要修改mysql的配置,将/etc/mysql/mysql.conf.d/mysqld.cnf中bind-address = 127.0.0.1注释掉。
有时候碰到报错Database ping failed with error Error 1045: Access denied for user 'artifactory'@'192.168.60.207' (using password: YES),主要是你账号密码不对,比如当前设置的是账号artifactory,密码是password
但是还需要继续配置哪些项存储到数据库,目前没有看到mysql.db文件更新,但是看到sqlite.db的更新。
5. jfrog存储位置的修改
1)首先是查看当前存储位置,web端可以查看,
2)停掉jfrog服务, systemctl stop artifactory.service
3)修改配置文件,sudo vim var/etc/artifactory/binarystore.xml,如下:
<config version="1">
<chain template="file-system"/>
<provider id="file-system" type="file-system"> <!-- Modify the "file-system" binary provider -->
<fileStoreDir>/media/share/jfrog/filestore</fileStoreDir> <!-- Override the <fileStoreDir> attribute -->
</provider>
</config>
4)拷贝原来存储位置的内容到新的位置 sudo cp -R -p var/data/artifactory/filestore /media/share/jfrog/
5)启动jfrog 服务。systemctl start artifactory.service
目前自启动有问题,并不是没有启动,而是启动一直hold在那,需要systemctl restart artifactory.service