如何在CentOS 8上安装JFrog Artifactory
今天的指南将引导我们完成在CentOS 8 Linux服务器上安装JFrog Artifactory的过程。 JFrog Artifactory是适用于云原生部署管道的高级存储库管理系统。借助JFrog,我们可以灵活地使用自己喜欢的编排工具,通过Artifactory中管理的不同配置包和应用程序工件(例如Docker和Helm)来管理应用程序部署。
JFrog Artifactory的特点:
- 基本工件管理
- 按需Jar签名和Web Start应用程序
- 储存库复制
- 非Maven模块管理的自定义存储库布局
- 通用支持所有主要包装格式
- 适用于NTLM,Kerberos等的强大SSO集成。
- Cloud Storage S3,Google Cloud Storage,Microsoft Azure Cloud Storage
- 高可用性设置支持- 与其他JFrog产品集成JFrog Xray,JFrog Mission Control,JFrog Pipelines,JFrog Bintray和JFrog CLI
- 与所有领先的CI服务器集成
- 提升,降级和清除构建工件
- 强大的REST API,用于发布自动化- 基本安全性LDAP身份验证,具有团队和权限的基于角色的授权
- 高级存储解决方案文件存储分片
在CentOS 8上安装JFrog Artifactory
我们将安装JFrogs Artifactory开源版本。如果我们有预算,也可以选择专业版。我们将使用Podman在CentOS 8上的容器中运行JFrog Artifactory。
更新系统
确保CentOS 8系统已更新。
sudo dnf update
在CentOS 8上安装Podman
在CentOS 8 Linux机器上安装Podman和容器工具。
sudo dnf -y install podman buildah
确认安装Podman:
$podman version Version: 1.6.4 RemoteAPI Version: 1 Go Version: go1.13.4 OS/Arch: linux/amd64 $podman info host: BuildahVersion: 1.12.0-dev CgroupVersion: v1 Conmon: package: conmon-2.0.6-1.module_el8.1.0+298+41f9343a.x86_64 path: /usr/bin/conmon version: 'conmon version 2.0.6, commit: 2721f230f94894671f141762bd0d1af2fb263239' Distribution: distribution: '"centos"' version: "8" MemFree: 114774016 MemTotal: 4031569920 OCIRuntime: name: runc package: runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64 path: /usr/bin/runc version: 'runc version spec: 1.0.1-dev' SwapFree: 0 SwapTotal: 0 arch: amd64 cpus: 2 eventlogger: journald hostname: centos.theitroad.local kernel: 4.18.0-147.8.1.el8_1.x86_64 os: linux rootless: false uptime: 23m 53.29s registries: blocked: null insecure: null search: - registry.access.redhat.com - registry.fedoraproject.org - registry.centos.org - docker.io store: ConfigFile: /etc/containers/storage.conf ContainerStore: number: 1 GraphDriverName: overlay GraphOptions: {} GraphRoot: /var/lib/containers/storage GraphStatus: Backing Filesystem: extfs Native Overlay Diff: "true" Supports d_type: "true" Using metacopy: "false" ImageStore: number: 1 RunRoot: /var/run/containers/storage VolumePath: /var/lib/containers/storage/volumes
下载JFrog Artifactory图像
下载JFrog Artifactory容器镜像:
$podman pull docker.bintray.io/jfrog/artifactory-oss:latest
确认图像在本地可用:
$podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.bintray.io/jfrog/artifactory-oss latest 3ed8110393b1 4 weeks ago 805 MB
对于商业版,请使用:
$podman pull docker.bintray.io/jfrog/artifactory-cpp-ce
在CentOS 8上运行JFrog Artifactory
为JFrog容器创建一个工作目录。 JFrog Artifactory将在此处存储其数据。
sudo mkdir -p /jfrog/artifactory sudo chown -R 1030 /jfrog
使用podman命令行工具在CentOS 8上启动JFrog Artifactory的实例:
podman run --name jfrog-artifactory \ -d -p 8081:8081 -p 8082:8082 \ -v /jfrog/artifactory:/var/opt/jfrog/artifactory \ docker.bintray.io/jfrog/artifactory-oss:latest
检查容器状态:
$podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ac0e102f254a docker.bintray.io/jfrog/artifactory-oss:latest 11 minutes ago Up 11 minutes ago 0.0.0.0:8081-8082->8081-8082/tcp artifactory
配置firewalld以允许访问JFrog Artifactory主应用程序端口。
sudo firewall-cmd --add-port=8081/tcp --permanent sudo firewall-cmd --add-port=8082/tcp --permanent sudo firewall-cmd --reload
使用Systemd在CentOS 8上管理JFrog Artifactory
如我们所见,正在使用podman命令行管理容器。让我们将systemd引入混合以确保服务可以在系统引导时自动启动。
sudo tee /etc/systemd/system/artifactory.service<<EOF [Unit] Description=Setup Systemd script for Artifactory Container After=network.target [Service] Restart=always ExecStartPre=-/usr/bin/podman kill artifactory ExecStartPre=-/usr/bin/podman rm artifactory ExecStart=/usr/bin/podman 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/podman kill artifactory ExecStop=-/usr/bin/podman rm artifactory [Install] WantedBy=multi-user.target EOF
重新加载systemd:
sudo systemctl daemon-reload
然后使用systemd启动Artifactory容器:
sudo systemctl start artifactory
启用它以在系统引导时启动。
$sudo systemctl enable artifactory Created symlink /etc/systemd/system/multi-user.target.wants/artifactory.service → /etc/systemd/system/artifactory.service.
可以通过以下方式检查状态:
$systemctl status artifactory ● artifactory.service - Setup Systemd script for Artifactory Container Loaded: loaded (/etc/systemd/system/artifactory.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2017-05-29 13:29:56 CEST; 31s ago Main PID: 21183 (podman) Tasks: 10 (limit: 24408) Memory: 33.7M CGroup: /system.slice/artifactory.service └─21183 /usr/bin/podman run --name artifactory -p 8081:8081 -p 8082:8082 -v /jfrog/artifactory:/var/opt/jfrog/artifactory docker.bintray.io Jan 29 13:30:24 centos.theitroad.local podman[21183]: 2017-05-29T11:30:24.363Z [jfac ] [INFO ] [d032e08be45c6acc] [CertificateFileHandlerBase:331> Jan 29 13:30:24 centos.theitroad.local podman[21183]: 2017-05-29T11:30:24.372Z [jfac ] [INFO ] [d032e08be45c6acc] [CertificateFileHandlerBase:125> Jan 29 13:30:24 centos.theitroad.local podman[21183]: 2017-05-29T11:30:24.372Z [jfac ] [INFO ] [d032e08be45c6acc] [CertificateFileHandlerBase:108> Jan 29 13:30:24 centos.theitroad.local podman[21183]: 2017-05-29T11:30:24.551Z [jfac ] [INFO ] [d032e08be45c6acc] [CertificateFileHandlerBase:331> Jan 29 13:30:24 centos.theitroad.local podman[21183]: 2017-05-29T11:30:24.551Z [jfac ] [INFO ] [d032e08be45c6acc] [CertificateFileHandlerBase:125> Jan 29 13:30:24 centos.theitroad.local podman[21183]: 2017-05-29T11:30:24.775Z [jfac ] [INFO ] [d032e08be45c6acc] [b.AccessServerBootstrapImpl:42> Jan 29 13:30:26 centos.theitroad.local podman[21183]: 2017-05-29T11:30:26.780Z [jfrt ] [INFO ] [35b2e6e932c70fb6] [ritiesStorageServiceFactory:25> Jan 29 13:30:27 centos.theitroad.local podman[21183]: 2017-05-29T11:30:27.093Z [jfac ] [INFO ] [d032e08be45c6acc] [o.j.a.s.r.s.GrpcServerImpl:65 > Jan 29 13:30:27 centos.theitroad.local podman[21183]: 2017-05-29T11:30:27.655Z [jfac ] [INFO ] [d032e08be45c6acc] [o.j.a.s.r.s.GrpcServerImpl:84 > Jan 29 13:30:27 centos.theitroad.local podman[21183]: 2017-05-29T11:30:27.731Z [jfac ] [INFO ] [d032e08be45c6acc] [o.j.a.s.s.JoinKeyAccess:166
访问Artifactory Web界面
确认该服务正在侦听并绑定。
# ss -tunelp | egrep '8081|8082' tcp LISTEN 0 128 0.0.0.0:8081 0.0.0.0:* users:(("conmon",pid=11018,fd=5)) ino:75048 sk:4 <-> tcp LISTEN 0 128 0.0.0.0:8082 0.0.0.0:* users:(("conmon",pid=11018,fd=6)) ino:75049 sk:5 <->
可以使用以下URL访问Artifactory:
http://SERVERIP_OR_DOMAIN:8081/artifactory -- OR - http://SERVERIP_OR_DOMAIN:8082/ui
我们应该看到Artifactory欢迎页面。
默认登录名是:
Username: admin Password: password
单击入门按钮。
通过设置一个新密码来重置管理员密码。
提供JFrog的基本URL。
选择要在安装过程中创建的存储库。
我们现在已经在CentOS 8 Linux机器上安装了JFrog Artifactory。