1、安装docker(略)
2、下载和安装docker-compose
wget https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64 -O docker-compose
chmod +x docker-compose
mv docker-compose /usr/bin/docker-compose
3、准备证书
mkdir /data/harbor/cert -p && cd /data/harbor/cert
openssl genrsa -out fly.cn.key 2048;openssl req -new -x509 -key fly.cn.key -out fly.cn.crt -days 3650 -subj /CN=*.fly.cn
4、下载地址harbor离线包
https://github.com/goharbor/harbor/releases/可到此地址下线最新的离线包
mkdir /data/harbor -p && cd /data/harbor
wget https://github.com/goharbor/harbor/releases/download/v2.2.1/harbor-offline-installer-v2.2.1.tgz
tar zxvf harbor-offline-installer-v2.2.1.tgz
cd harbor/
cp harbor.yml.tmpl harbor.yml
5、harbor.yml 修改几个重要的配置
hostname: harbor.fly.cn #配置harbor的域名
http:
port: 777
https:
port: 7443
certificate: /data/harbor/cert/fly.cn.crt #证书
private_key: /data/harbor/cert/fly.cn.key #证书
harbor_admin_password: Harbor123456 #harbor的密码
database:
password: root123 #数据库的密码
data_volume: /data/harbor/data
metric: #配置监控
enabled: true
port: 9090
path: /metrics
6、安装启动harbor
./install.sh --with-chartmuseum --with-trivy
# --with-chartmuseum 启用helm仓库
# --with-trivy 使用trivy安全扫描工具
7、确认harbor安装
[root@centos7 harbor]# docker ps -a|grep harbor
e0138e27e7e9 goharbor/nginx-photon:v2.2.1 "nginx -g 'daemon of…" 5 minutes ago Up 5 minutes (healthy) 0.0.0.0:9090->9090/tcp, 0.0.0.0:777->8080/tcp, 0.0.0.0:7443->8443/tcp nginx
1a0b9c57ef2e goharbor/harbor-jobservice:v2.2.1 "/harbor/entrypoint.…" 5 minutes ago Up 5 minutes (healthy) harbor-jobservice
e7e7b299f068 goharbor/harbor-exporter:v2.2.1 "/harbor/entrypoint.…" 5 minutes ago Up 5 minutes harbor-exporter
7aade51bf73d goharbor/trivy-adapter-photon:v2.2.1 "/home/scanner/entry…" 5 minutes ago Up 5 minutes (healthy) trivy-adapter
a962924b1b9a goharbor/harbor-core:v2.2.1 "/harbor/entrypoint.…" 5 minutes ago Up 5 minutes (healthy) harbor-core
d42633880abc goharbor/harbor-registryctl:v2.2.1 "/home/harbor/start.…" 5 minutes ago Up 5 minutes (healthy) registryctl
bff5e82e739c goharbor/harbor-portal:v2.2.1 "nginx -g 'daemon of…" 5 minutes ago Up 5 minutes (healthy) harbor-portal
fc6b760c1c17 goharbor/harbor-db:v2.2.1 "/docker-entrypoint.…" 5 minutes ago Up 5 minutes (healthy) harbor-db
8171f0d905d5 goharbor/redis-photon:v2.2.1 "redis-server /etc/r…" 5 minutes ago Up 5 minutes (healthy) redis
f5dc556ac600 goharbor/registry-photon:v2.2.1 "/home/harbor/entryp…" 5 minutes ago Up 5 minutes (healthy) registry
d0012b271ba0 goharbor/chartmuseum-photon:v2.2.1 "./docker-entrypoint…" 5 minutes ago Up 5 minutes (healthy) chartmuseum
c0838a82e589 goharbor/harbor-log:v2.2.1 "/bin/sh -c /usr/loc…" 5 minutes ago Up 5 minutes (healthy) 127.0.0.1:1514->10514/tcp harbor-log