提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

目录

前言

一、准备阶段

1.安装包

2.数据存储

3.日志路径

4.docker & docker-compose环境

二、操作步骤

1.解压安装包

2.加载镜像

3.生成harbor配置文件

4.生成docker-compose.yml文件

5.开始安装

三、主备高可用


前言

Harbor V2版本镜像仓库环境安装部署指导


一、准备阶段

1.安装包

查看待安装主机的架构,准备对应的安装包,官网上应该可以下载,我这里是在ARM架构主机上部署,使用的软件包为:

harbor-offline-installer-v3-arm64..tgz

附:Harbor官方安装包下载地址:

https://github.com/goharbor/harbor/releases

2.数据存储

一般是本次磁盘目录,找一个规划好的磁盘路径或者磁盘容器较大的磁盘存在存储数据
data_volume: /mnt/data2/icaas/harbor

3.日志路径

日志路径默认存放在/var/log/harbor下面,根据实际情况调整
location: /var/log/harbor

4.docker & docker-compose环境

harbor安装部署使用的docker-compose安装的,需要具备docker和docker-compose环境

二、操作步骤

1.解压安装包

tar -zxvf harbor-offline-installer-v3-arm64..tgz

2.加载镜像

docker load -i harbor.v2.13.0.tar.gz
查看镜像
docker images|grep -E "harbor|photon|prepare|registry"

3.生成harbor配置文件

cp -rf harbor.yml.tmpl harbor.yml
根据实际情况修改harbor安装文件内容:
备注说明:一般来说只要修改如下几点即可:
  • (1) 访问IP地址:hostname: 172.32.150.72 --> The IP address or hostname to access admin UI and registry service
  • (2) port: 80 --> 修改端口
  • (3) 注释掉https相关配置
#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
  • (4) 修改日志路径:location: /var/log/harbor --> 根据实际情况修改(主要是存储目录容量大小是否足够)
  • (5) 数据文件存储路径:data_volume: /mnt/data1/harbortest --> 一般是本次磁盘目录,找一个规划好的磁盘路径或者磁盘容器较大的磁盘存在存储数据
Harbor配置文件,可以参考安装包中的样例模版文件:
文件名:harbor.yml.tmpl

4.生成docker-compose.yml文件

cd /mnt/data2/wangteng/harborunstall/harbor
(base) [root@arm4 harbor]# ll
total 518M
drwxr-xr-x 3 root root 4.0K Nov 13 11:18 common
-rw-r--r-- 1 root root 3.6K Oct  9 09:40 common.sh
-rw-r--r-- 1 root root 5.9K Nov 13 12:20 docker-compose.yml
-rw-r--r-- 1 root root 518M Oct  9 09:41 harbor.v2.13.0.tar.gz
-rw-r--r-- 1 root root  15K Nov 13 11:14 harbor.yml
-rw-r--r-- 1 root root  15K Oct  9 09:40 harbor.yml.tmpl
-rwxr-xr-x 1 root root 2.0K Oct  9 09:40 install.sh
-rw-r--r-- 1 root root  12K Oct  9 09:40 LICENSE
-rwxr-xr-x 1 root root 2.2K Oct  9 09:40 prepare

执行如下命令生成文件:

./prepare

5.开始安装

./install.sh

安装过程记录如下:

(base) [root@arm4 harbor]# ./install.sh

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.20

[Step 1]: checking docker-compose is installed ...

Note: docker-compose version: 2.33.1

[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-log:v2.13.0
Loaded image: goharbor/nginx-photon:v2.13.0
Loaded image: goharbor/registry-photon:v2.13.0
Loaded image: goharbor/prepare:v2.13.0
Loaded image: goharbor/harbor-portal:v2.13.0
Loaded image: goharbor/harbor-core:v2.13.0
Loaded image: goharbor/harbor-exporter:v2.13.0
Loaded image: goharbor/redis-photon:v2.13.0
Loaded image: goharbor/harbor-db:v2.13.0
Loaded image: goharbor/harbor-jobservice:v2.13.0
Loaded image: goharbor/harbor-registryctl:v2.13.0


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /mnt/data2/wangteng/harborunstall/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/registry/passwd
Clearing the configuration file: /config/registry/root.crt
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
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
copy /data/secret/tls/harbor_internal_ca.crt to shared trust ca dir as name harbor_internal_ca.crt ...
ca file /hostfs/data/secret/tls/harbor_internal_ca.crt is not exist
copy  to shared trust ca dir as name storage_ca_bundle.crt ...
copy None to shared trust ca dir as name redis_tls_ca.crt ...
loaded secret from file: /data/secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...


[Step 5]: starting Harbor ...
[+] Running 10/10
 ✔ Network harbor_harbor        Created                                                                                                                                       0.2s
 ✔ Container harbor-log         Started                                                                                                                                       0.5s
 ✔ Container harbor-db          Started                                                                                                                                       1.3s
 ✔ Container registryctl        Started                                                                                                                                       1.3s
 ✔ Container registry           Started                                                                                                                                       1.1s
 ✔ Container redis              Started                                                                                                                                       1.1s
 ✔ Container harbor-portal      Started                                                                                                                                       1.1s
 ✔ Container harbor-core        Started                                                                                                                                       1.7s
 ✔ Container harbor-jobservice  Started                                                                                                                                       2.1s
 ✔ Container nginx              Started                                                                                                                                       2.2s
✔ ----Harbor has been installed and started successfully.----

访问一下Harbor UI前端如下:

默认登录信息:admin/Harbor12345

安装完成。

三、主备高可用

说明:在另一台主机上按照上面的步骤再部署一次,然后主备之间建议一下同步任务即可实现。

---------------结束------------

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐