环境:
OS:Centos 7
说明:需要docker和 docker compose
[root@node1 data]# docker version
Client: Docker Engine - CommunityVersion: 26.1.4API version: 1.45Go version: go1.21.11Git commit: 5650f9bBuilt: Wed Jun 5 11:32:04 2024OS/Arch: linux/amd64Context: defaultServer: Docker Engine - CommunityEngine:Version: 26.1.4API version: 1.45 (minimum version 1.24)Go version: go1.21.11Git commit: de5c9cfBuilt: Wed Jun 5 11:31:02 2024OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.6.33GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957runc:Version: 1.1.12GitCommit: v1.1.12-0-g51d5e94docker-init:Version: 0.19.0GitCommit: de40ad0[root@node1 data]# docker compose version
Docker Compose version v2.27.1
1.下载安装包
cd /soft
wget https://github.com/goharbor/harbor/releases/download/v2.12.2/harbor-offline-installer-v2.12.2.tgz
2.解压安装
# 解压
cd soft
tar -zxvf harbor-offline-installer-v2.12.2.tgz
mv harbor /opt/
3.修改配置文件
cd /opt/harbor
# 复制一份配置文件
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
hostname: 192.168.1.105 ##本机ip# http related config
http:# port for http, default is 80. If https enabled, this port will redirect to https portport: 8001 ##自定义端口#注释掉https
# https related config
#https:# https port for harbor, default is 443#port: 443# The path of cert and key files for nginx#certificate: /your/certificate/path#private_key: /your/private/key/path# enable strong ssl ciphers (default: false)# strong_ssl_ciphers: false##默认密码,可修改
harbor_admin_password: Harbor12345
4.运行
[root@node1 harbor]# cd /opt/harbor
[root@node1 harbor]# sh install.sh[Step 0]: checking if docker is installed ...Note: docker version: 26.1.4[Step 1]: checking docker-compose is installed ...Note: Docker Compose version v2.27.1[Step 2]: loading Harbor images ...
7500af65fc4e: Loading layer [==================================================>] 40.8MB/40.8MB
a55ae973a3c0: Loading layer [==================================================>] 16.58MB/16.58MB
955d461b1b0b: Loading layer [==================================================>] 110.6MB/110.6MB
2d3a52af2778: Loading layer [==================================================>] 3.072kB/3.072kB
546e51a67661: Loading layer [==================================================>] 59.9kB/59.9kB
9afb70024922: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.12.2
99205718f6d2: Loading layer [==================================================>] 115.7MB/115.7MB
Loaded image: goharbor/nginx-photon:v2.12.2
a3c20a191851: Loading layer [==================================================>] 8.665MB/8.665MB
af2c9b9c6abf: Loading layer [==================================================>] 4.096kB/4.096kB
2c5c57e9fb7b: Loading layer [==================================================>] 3.072kB/3.072kB
62a568fd3d67: Loading layer [==================================================>] 18.14MB/18.14MB
c08f5462efe0: Loading layer [==================================================>] 18.93MB/18.93MB
Loaded image: goharbor/registry-photon:v2.12.2
cda5d077aab0: Loading layer [==================================================>] 106.7MB/106.7MB
27bf92f7f95a: Loading layer [==================================================>] 48.89MB/48.89MB
3c8209500db7: Loading layer [==================================================>] 14.09MB/14.09MB
58d64cb77a32: Loading layer [==================================================>] 66.05kB/66.05kB
c14ed3bd07b3: Loading layer [==================================================>] 2.56kB/2.56kB
287d48d5f2f7: Loading layer [==================================================>] 1.536kB/1.536kB
2b13a9f46675: Loading layer [==================================================>] 12.29kB/12.29kB
1f28d5daf3e4: Loading layer [==================================================>] 2.746MB/2.746MB
5c576651b13f: Loading layer [==================================================>] 525.3kB/525.3kB
Loaded image: goharbor/prepare:v2.12.2
938636294210: Loading layer [==================================================>] 115.7MB/115.7MB
500afbc9e795: Loading layer [==================================================>] 6.731MB/6.731MB
26d30c253151: Loading layer [==================================================>] 252.9kB/252.9kB
43fa8673442e: Loading layer [==================================================>] 1.497MB/1.497MB
Loaded image: goharbor/harbor-portal:v2.12.2
8d71fd9a31e6: Loading layer [==================================================>] 11.62MB/11.62MB
dbc682df94c4: Loading layer [==================================================>] 3.584kB/3.584kB
dc23865e6058: Loading layer [==================================================>] 2.56kB/2.56kB
5b3a409f2f20: Loading layer [==================================================>] 70.97MB/70.97MB
f0284987c0a8: Loading layer [==================================================>] 5.632kB/5.632kB
aa6edf920ac9: Loading layer [==================================================>] 126.5kB/126.5kB
1b0e2e49cba1: Loading layer [==================================================>] 201.7kB/201.7kB
ef3869fb00f6: Loading layer [==================================================>] 72.09MB/72.09MB
b5adee9a937f: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.12.2
3ab5388d6c1f: Loading layer [==================================================>] 11.62MB/11.62MB
52ac88b67ec0: Loading layer [==================================================>] 3.584kB/3.584kB
23676721f5ac: Loading layer [==================================================>] 2.56kB/2.56kB
da4925be0f76: Loading layer [==================================================>] 59.9MB/59.9MB
d3e58b02c185: Loading layer [==================================================>] 60.69MB/60.69MB
Loaded image: goharbor/harbor-jobservice:v2.12.2
49571a6d0c94: Loading layer [==================================================>] 8.665MB/8.665MB
c8e310458659: Loading layer [==================================================>] 4.096kB/4.096kB
77d0d4efc470: Loading layer [==================================================>] 18.14MB/18.14MB
cfe621a827a8: Loading layer [==================================================>] 3.072kB/3.072kB
da069b610985: Loading layer [==================================================>] 37.13MB/37.13MB
886ab49e2c00: Loading layer [==================================================>] 56.05MB/56.05MB
Loaded image: goharbor/harbor-registryctl:v2.12.2
89e8aad4a743: Loading layer [==================================================>] 125.3MB/125.3MB
49294283b368: Loading layer [==================================================>] 3.584kB/3.584kB
944950bed8d9: Loading layer [==================================================>] 3.072kB/3.072kB
4d3d3de84f7b: Loading layer [==================================================>] 2.56kB/2.56kB
79ac17301f19: Loading layer [==================================================>] 3.072kB/3.072kB
38527cecbdbd: Loading layer [==================================================>] 3.584kB/3.584kB
96b7366e087e: Loading layer [==================================================>] 20.48kB/20.48kB
Loaded image: goharbor/harbor-log:v2.12.2
cc9bdb3b495c: Loading layer [==================================================>] 16.58MB/16.58MB
a274e637f08b: Loading layer [==================================================>] 175.1MB/175.1MB
75dbffff2db6: Loading layer [==================================================>] 26.15MB/26.15MB
e5057c1d974b: Loading layer [==================================================>] 18.65MB/18.65MB
c5176d7594bc: Loading layer [==================================================>] 5.12kB/5.12kB
e025810ce33f: Loading layer [==================================================>] 6.144kB/6.144kB
680b504334c2: Loading layer [==================================================>] 3.072kB/3.072kB
6d1ecb260b6c: Loading layer [==================================================>] 2.048kB/2.048kB
e7f993087c57: Loading layer [==================================================>] 2.56kB/2.56kB
381d0b31c127: Loading layer [==================================================>] 7.68kB/7.68kB
Loaded image: goharbor/harbor-db:v2.12.2
5eddf3753425: Loading layer [==================================================>] 11.62MB/11.62MB
a7c4ef10d45b: Loading layer [==================================================>] 37.15MB/37.15MB
6a7d0016a4ac: Loading layer [==================================================>] 4.608kB/4.608kB
2c1156f81855: Loading layer [==================================================>] 37.94MB/37.94MB
Loaded image: goharbor/harbor-exporter:v2.12.2
760d5a6e0905: Loading layer [==================================================>] 9.158MB/9.158MB
cc95934e628f: Loading layer [==================================================>] 4.096kB/4.096kB
b92e412c712f: Loading layer [==================================================>] 3.072kB/3.072kB
b78eff431d6e: Loading layer [==================================================>] 132.1MB/132.1MB
f4d593c02855: Loading layer [==================================================>] 15.55MB/15.55MB
8e1b47497859: Loading layer [==================================================>] 148.5MB/148.5MB
Loaded image: goharbor/trivy-adapter-photon:v2.12.2[Step 3]: preparing environment ...[Step 4]: preparing harbor configs ...
prepare base dir is set to /opt/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dirNote: stopping existing Harbor instance ...[Step 5]: starting Harbor ...
[+] Running 10/10? Network harbor_harbor Created 0.2s ? Container harbor-log Started 1.8s ? Container redis Started 4.0s ? Container registryctl Started 5.3s ? Container harbor-db Started 5.3s ? Container registry Started 4.8s ? Container harbor-portal Started 5.1s ? Container harbor-core Started 6.9s ? Container harbor-jobservice Started 10.1s ? Container nginx Started 10.4s
? ----Harbor has been installed and started successfully.----
5.登录
http://192.168.1.105:8001
默认账号 密码
admin Harbor12345