2.5. harbor安装

参考地址:https://www.yuque.com/duduniao/trp3ic/ohrxds#9Zpxx

官方地址:https://goharbor.io/

下载地址:https://github.com/goharbor/harbor/releases

2.5.1. hdss7-200 安装harbor

# 目录说明:
# /opt/src : 源码、文件下载目录
# /opt/release : 各个版本软件存放位置
# /opt/apps : 各个软件当前版本的软链接
[root@hdss7-200 ~]# cd /opt/src
[root@hdss7-200 src]# wget https://github.com/goharbor/harbor/releases/download/v1.9.4/harbor-offline-installer-v1.9.4.tgz
[root@hdss7-200 src]# mv harbor /opt/release/harbor-v1.9.4
[root@hdss7-200 src]# ln -s /opt/release/harbor-v1.9.4 /opt/apps/harbor
[root@hdss7-200 src]# ll /opt/apps/
total 0
lrwxrwxrwx 1 root root 26 Jan  5 11:13 harbor -> /opt/release/harbor-v1.9.4
# 实验环境仅修改以下配置项,生产环境还得修改密码
[root@hdss7-200 src]# vim /opt/apps/harbor/harbor.yml
hostname: harbor.od.com
http:
  port: 180
data_volume: /data/harbor
location: /data/harbor/logs
[root@hdss7-200 src]# yum install -y docker-compose
[root@hdss7-200 src]# cd /opt/apps/harbor/
[root@hdss7-200 harbor]# ./install.sh 
✔ ----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at http://harbor.od.com . 
For more details, please visit https://github.com/goharbor/harbor .


2.5.2. hdss7-200 安装nginx

安装Nginx反向代理harbor

# 当前机器中Nginx功能较少,使用yum安装即可。如有多个harbor考虑源码编译且配置健康检查
# nginx配置此处忽略,仅仅使用最简单的配置。
[root@hdss7-200 harbor]# vim /etc/nginx/conf.d/harbor.conf
[root@hdss7-200 harbor]# cat /etc/nginx/conf.d/harbor.conf
server {
    listen       80;
    server_name  harbor.od.com;
    # 避免出现上传失败的情况
    client_max_body_size 1000m;

    location / {
        proxy_pass http://127.0.0.1:180;
    }
}
[root@hdss7-200 harbor]# systemctl start nginx ; systemctl enable nginx

hdss7-11 配置DNS解析

[root@hdss7-11 ~]# vim /var/named/od.com.zone  # 序列号需要滚动一个
$ORIGIN od.com.
$TTL 600  ; 10 minutes
@       IN SOA  dns.od.com. dnsadmin.od.com. (
        2020070602 ; serial
        10800      ; refresh (3 hours)
        900        ; retry (15 minutes)
        604800     ; expire (1 week)
        86400      ; minimum (1 day)
        )
        NS   dns.od.com.
$TTL 60 ; 1 minute
dns                A    10.4.7.11
harbor             A    10.4.7.200
[root@hdss7-11 ~]# systemctl restart named.service  # reload 无法使得配置生效
[root@hdss7-11 ~]# host harbor.od.com
harbor.od.com has address 10.4.7.200

安装harbor私有仓库

新建项目:public

安装harbor私有仓库

测试harbor

[root@hdss7-21 ~]# docker image tag nginx:latest harbor.od.com/public/nginx:latest
[root@hdss7-21 ~]# docker login -u admin harbor.od.com
[root@hdss7-21 ~]# docker image push harbor.od.com/public/nginx:latest
[root@hdss7-21 ~]# docker logout 

安装harbor私有仓库

相关文章:

  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
  • 2022-01-05
  • 2021-12-25
  • 2021-06-28
猜你喜欢
  • 2021-11-22
  • 2021-07-02
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2021-05-25
相关资源
相似解决方案