Harbor 的安装及使用

Harbor 安装官网手册:
https://goharbor.io/docs/2.10.0/install-config/download-installer/

Harbor 发布包地址:
https://github.com/goharbor/harbor/releases

Harbor 的架构查看:
https://github.com/goharbor/harbor/wiki/Architecture-Overview-of-Harbor

  • 在部署harbor的前提下先安装docker 和 docker-compose

    安装docker:https://docs.docker.com/engine/install/centos/
    安装docker-compos: https://docs.docker.com/compose/install/standalone/

  • 下载 Offline installer 安装包(如果网络慢可以选择科学上网下载到服务器上)
    wget -P /opt -https://github.com/goharbor/harbor/releases/download/v2.9.3-rc1/harbor-offline-installer-v2.9.3-rc1.tgz

  • 解压

      # tar -zxvf harbor-offline-installer-v2.9.3-rc1.tgz
    
    # tree  harbor
    harbor
    ├── common.sh
    ├── harbor.v2.9.3.tar.gz
    ├── harbor.yml.tmpl
    ├── install.sh
    ├── LICENSE
    └── prepare
    
    0 directories, 6 files
    
  • 配置文件各项含义

    配置文件模版为harbor.yml.tmpl 使用时,将 cp harbor.yml.tmpl harbor.yml

    官网配置文件文档:https://goharbor.io/docs/2.10.0/install-config/configure-yml-file/

  • 修改配置文件

    # cp harbor.yml.tmpl harbor.yml
    # cat harbor.yml
    
    hostname: 192.168.44.161		# 由于harbor是docker部署,所有这里需要写宿主机的IP(可以访问的域名)
    # 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
    ......
    其他的可以默认
    
  • 安装Harbor
    默认的 Harbor 安装不包括 Trivy 服务。运行以下命令

      ./install.sh
    

    要使用 Trivy 服务安装 Harbor,请–with-trivy在运行时添加参数install.sh:

      ./install.sh --with-trivy
    
  • 使用查看所有服务

      # docker-compose ls
    
    # docker-compose ls
    NAME                STATUS              CONFIG FILES
    harbor              running(10)         /opt/harbor/docker-compose.yml
    
    # docker-compose ps		# 需要在yaml文件同级目录下执行
    NAME                IMAGE                                  COMMAND                   SERVICE         CREATED          STATUS                    PORTS
    harbor-core         goharbor/harbor-core:v2.9.3            "/harbor/entrypoint.…"   core            13 minutes ago   Up 13 minutes (healthy)   
    harbor-db           goharbor/harbor-db:v2.9.3              "/docker-entrypoint.…"   postgresql      13 minutes ago   Up 13 minutes (healthy)   
    harbor-jobservice   goharbor/harbor-jobservice:v2.9.3      "/harbor/entrypoint.…"   jobservice      13 minutes ago   Up 13 minutes (healthy)   
    harbor-log          goharbor/harbor-log:v2.9.3             "/bin/sh -c /usr/loc…"   log             13 minutes ago   Up 13 minutes (healthy)   127.0.0.1:1514->10514/tcp
    harbor-portal       goharbor/harbor-portal:v2.9.3          "nginx -g 'daemon of…"   portal          13 minutes ago   Up 13 minutes (healthy)   
    nginx               goharbor/nginx-photon:v2.9.3           "nginx -g 'daemon of…"   proxy           13 minutes ago   Up 13 minutes (healthy)   0.0.0.0:80->8080/tcp, :::80->8080/tcp
    redis               goharbor/redis-photon:v2.9.3           "redis-server /etc/r…"   redis           13 minutes ago   Up 13 minutes (healthy)   
    registry            goharbor/registry-photon:v2.9.3        "/home/harbor/entryp…"   registry        13 minutes ago   Up 13 minutes (healthy)   
    registryctl         goharbor/harbor-registryctl:v2.9.3     "/home/harbor/start.…"   registryctl     13 minutes ago   Up 13 minutes (healthy)   
    trivy-adapter       goharbor/trivy-adapter-photon:v2.9.3   "/home/scanner/entry…"   trivy-adapter   13 minutes ago   Up 13 minutes (healthy)
    
  • 管理 harbor
    停止

      # docker-compose down -v
    

    启动

      # docker-compose up -d
    
  • 访问harbor
    默认账号密码是: admin/Harbor12345
    在这里插入图片描述

  • 23
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值