https://github.com/goharbor/harbor/releases?page=2
https://github.com/goharbor/harbor/releases/download/v2.3.4/harbor-offline-installer-v2.3.4.tgz
harbor官網:https://goharbor.io/
點擊 Download now 鏈接,會自動跳轉到上述github頁面,但是網速不行,嘗試用服務器下載:
在服務器上:
[root@VM-24-17-centos ~]# wget https://github.com/goharbor/harbor/releases/download/v2.3.4/harbor-offline-installer-v2.3.4.tgz
經過漫長的等待。。。
安裝前說明:harbor依賴docker 和 docker-compose
所以服務器上要安裝好docker + docker compose
解壓:
[root@VM-24-17-centos harbor]# cp harbor.yml.tmpl harbor.yml
[root@VM-24-17-centos harbor]# vim harbor.yml
修改項如下:
- 域名+端口
hostname: 101.43.xxx.xx
port: 3306
因為特殊原因,80端口用于轉發請求到es, 6379用于mysql從庫,3306原本用于gaussdb,現在停了所以用3306端口(就這么神奇~)
mac使用nc,windows使用telnet命令:jelex@jelexxudeMacBook-Pro ~ % nc -zv 101.43.xxx.xx 3306nc: connectx to 101.43.xxx.xx port 3306 (tcp) failed: Connection refusedjelex@jelexxudeMacBook-Pro ~ % nc -zv 101.43.xxx.xx 6379Connection to 101.43.xxx.x port 6379 [tcp/*] succeeded!jelex@jelexxudeMacBook-Pro ~ % nc -zv 101.43.xxx.xx 80Connection to 101.43.xxx.x port 80 [tcp/http] succeeded!jelex@jelexxudeMacBook-Pro ~ %
- 注釋掉https
- 修改密碼
harbor_admin_password: as you will… - 默認數據存在目錄
啟動:[root@VM-24-17-centos harbor]# ./install.sh
。。。 。。。
發現多了一堆容器:
訪問http://101.43.xxx.x:3306/
跳轉如下頁面:
修改docker主機配置文件,使docker支持harbor
[root@VM-24-17-centos harbor]# vim /etc/docker/daemon.json
FYI:"registry-mirrors": ["https://mirror.ccs.tencentyun.com"][root@VM-24-17-centos harbor]# cat /etc/docker/daemon.json
{"registry-mirrors": ["https://mirror.ccs.tencentyun.com"],"insecure-registries":["101.43.141.9:3306"]
}重啟docker:
[root@VM-24-17-centos harbor]# systemctl restart docker設置 harbor 開啟啟動
vim /lib/systemd/system/harbor.service[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor[Service]
Type=simple
Restart=on-failure
RestartSec=5
# 需要注意 harbor 的安裝位置
ExecStart=/usr/local/bin/docker-compose -f /root/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /root/harbor/docker-compose.yml stop[Install]
WantedBy=multi-user.target
必須使用 docker-compose up 命令啟動
systemctl daemon-reload
systemctl enable harbor # 開機自啟
systemctl start harbor # 啟動
harbor使用: