Harbor 安装简记

还是安装 awx 引发的问题,由于 awx 已经不提供完整的 docker 镜像了,需要自己手动 build 生成。在 build 的过程中,会下载各种依赖,包括从 github 下载相关文件,然而在大局域网的环境下,you know?

我计划在腾讯云创建一台按量计费的外网主机,以便在 build 成功之后,将镜像传回来使用。再加上一直想部署一套自己的镜像托管平台,所以 Harbor 搞起来!

安装 Harbor 的过程很简单,官网上都有详细的介绍。下面就来过一下流水账,顺便做些提醒。

  1. 下载离线镜像并解压
wget https://github.com/goharbor/harbor/releases/download/v2.5.0/harbor-offline-installer-v2.5.0.tgz
tar xzvf harbor-offline-installer-v2.5.0.tgz
  1. 编辑 Harbor 配置文件
# 先把模板重命名
cp harbor.yml.tmpl harbor.yml
# 修改配置文件
vi harbor.yml
# 建议修改以下几处地方

# 修改域名及端口
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: reg.mydomain.com

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 80

# 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

# 修改管理员密码及数据库密码(重要)
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345

# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: root123
  # The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.
  max_idle_conns: 100
  # The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections.
  # Note: the default number of connections is 1024 for postgres of harbor.
  max_open_conns: 900

# 修改数据存储路径
# The default data volume
data_volume: /data

其他倒没啥了,具体配置信息请参考:https://goharbor.io/docs/2.5.0/install-config/configure-yml-file/

  1. 执行安装脚本
bash install.sh

完成安装后,访问配置文件里面配置的地址即可。