Harbor安装小坑Please set hostname and other necessary attributes in harbor.cfg first.

HarBor安装小坑

➜ Please set hostname and other necessary attributes in harbor.cfg first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.cfg bacause notary must run under https.
Please set --with-clair if needs enable Clair in Harbor
Please set --with-chartmuseum if needs enable Chartmuseum in Harbor

安装harbor需要将hostname修改为本机ip,然后我也修改了(我是先复制了当前hostname那行并注释掉,然后再修改的,如下),但是执行./install.sh安装时候一直报错
首先修改harbor.cfg配置

root@server02:~/harbor# vim harbor.cfg

如下:

#hostname = reg.mydomain.com
hostname = 192.168.1.2

然后看install.sh 脚本,发现脚本是grep原脚本进行校验的,如下:

# The hostname in harbor.cfg has not been modified
if grep 'hostname = reg.mydomain.com' &> /dev/null harbor.cfg
then
        echo "my test"
        warn "$usage"
        exit 1
fi

执行启动命令

root@server02:~/harbor# ./install.sh

报错信息
my test
➜ Please set hostname and other necessary attributes in harbor.cfg first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.cfg bacause notary must run under https.
Please set --with-clair if needs enable Clair in Harbor
root@server02:~/harbor#

解决问题
因修改harbor.cfg配置时采用将原#hostname = reg.mydomain.com注释,另起一行重新配置导致启动报错,所以只需将原有hostname = 192.168.1.2即可。如下:

hostname = 192.168.1.2

执行命令:

[root@jenkins harbor]#sh install.sh

[Step 0]: checking installation environment ...

Note: docker version: 20.10.9

Note: docker-compose version: 1.28.3

[Step 1]: loading Harbor images ...
ad50e89f4922: Loading layer [==================================================>]  133.4MB/133.4MB
8c9a00a7f290: Loading layer [==================================================>]  73.29MB/73.29MB
078e22641f73: Loading layer [==================================================>]  3.584kB/3.584kB
5494f0d704cb: Loading layer [==================================================>]  3.072kB/3.072kB
34c7e304d18b: Loading layer [==================================================>]  4.096kB/4.096kB
ae9209f78c11: Loading layer [==================================================>]  3.584kB/3.584kB
1498359f7391: Loading layer [==================================================>]  9.728kB/9.728kB
Loaded image: goharbor/harbor-log:v1.6.1
bb738fd5b202: Loading layer [==================================================>]  23.38MB/23.38MB
51f6c7e046ae: Loading layer [==================================================>]  21.15MB/21.15MB
67ff79ae8340: Loading layer [==================================================>]  21.15MB/21.15MB
Loaded image: goharbor/harbor-jobservice:v1.6.1
b5be864bae6a: Loading layer [==================================================>]  83.89MB/83.89MB
9fdbae37c606: Loading layer [==================================================>]  3.072kB/3.072kB
c24b06c70085: Loading layer [==================================================>]   59.9kB/59.9kB
946c040a69da: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v1.6.1
747ac74b0475: Loading layer [==================================================>]  5.128MB/5.128MB
Loaded image: goharbor/nginx-photon:v1.6.1
3d4aae33f4f1: Loading layer [==================================================>]    683MB/683MB
3cb271cda7e0: Loading layer [==================================================>]   7.68kB/7.68kB
7ae402931bdb: Loading layer [==================================================>]  197.6kB/197.6kB
Loaded image: goharbor/harbor-migrator:v1.6.1
67747a74e108: Loading layer [==================================================>]  158.1MB/158.1MB
93f3d22257c7: Loading layer [==================================================>]  35.08MB/35.08MB
2eda636f347b: Loading layer [==================================================>]   2.56kB/2.56kB
7a3b4ef015e8: Loading layer [==================================================>]  35.08MB/35.08MB
Loaded image: goharbor/chartmuseum-photon:v0.7.1-v1.6.1
038c23438769: Loading layer [==================================================>]  23.38MB/23.38MB
a6a0201bf457: Loading layer [==================================================>]  26.88MB/26.88MB
aa0986b7d608: Loading layer [==================================================>]  7.168kB/7.168kB
830a350d7059: Loading layer [==================================================>]  11.32MB/11.32MB
3100afecce3d: Loading layer [==================================================>]  26.87MB/26.87MB
Loaded image: goharbor/harbor-ui:v1.6.1
15134eb6d277: Loading layer [==================================================>]  95.85MB/95.85MB
02cff5f31ca4: Loading layer [==================================================>]  6.656kB/6.656kB
3e43f3cb1d4c: Loading layer [==================================================>]  2.048kB/2.048kB
4ab1b74a5650: Loading layer [==================================================>]   7.68kB/7.68kB
9c78faccbd48: Loading layer [==================================================>]   2.56kB/2.56kB
158d4a16071f: Loading layer [==================================================>]   2.56kB/2.56kB
6a2fbfb6100b: Loading layer [==================================================>]   2.56kB/2.56kB
Loaded image: goharbor/harbor-db:v1.6.1
b15fe66f326a: Loading layer [==================================================>]  23.38MB/23.38MB
336e69120569: Loading layer [==================================================>]  3.072kB/3.072kB
f308142e2037: Loading layer [==================================================>]  3.072kB/3.072kB
3119c7884a49: Loading layer [==================================================>]  2.048kB/2.048kB
fafa9955d095: Loading layer [==================================================>]   22.8MB/22.8MB
4c53b946082a: Loading layer [==================================================>]   22.8MB/22.8MB
Loaded image: goharbor/registry-photon:v2.6.2-v1.6.1
0fee5e457010: Loading layer [==================================================>]  23.38MB/23.38MB
6d1b402441fc: Loading layer [==================================================>]  12.16MB/12.16MB
765a288fcf5a: Loading layer [==================================================>]   17.3MB/17.3MB
da4578643aee: Loading layer [==================================================>]  11.26kB/11.26kB
f02d275fa76f: Loading layer [==================================================>]  3.072kB/3.072kB
4a3d1e973223: Loading layer [==================================================>]  29.46MB/29.46MB
Loaded image: goharbor/notary-server-photon:v0.5.1-v1.6.1
918b224a19fd: Loading layer [==================================================>]  10.95MB/10.95MB
ff41acdef199: Loading layer [==================================================>]   17.3MB/17.3MB
4389d5e9282a: Loading layer [==================================================>]  11.26kB/11.26kB
8a0e0bb6ed63: Loading layer [==================================================>]  3.072kB/3.072kB
d437ffa494e0: Loading layer [==================================================>]  28.24MB/28.24MB
Loaded image: goharbor/notary-signer-photon:v0.5.1-v1.6.1
1c86e9f19207: Loading layer [==================================================>]  158.1MB/158.1MB
3b4698fe61a0: Loading layer [==================================================>]  10.93MB/10.93MB
8dbd6d55a6cd: Loading layer [==================================================>]  2.048kB/2.048kB
5cb748f1dcf1: Loading layer [==================================================>]  48.13kB/48.13kB
f86a42ee549b: Loading layer [==================================================>]  10.98MB/10.98MB
Loaded image: goharbor/clair-photon:v2.0.6-v1.6.1
18abf81cd9fd: Loading layer [==================================================>]  23.38MB/23.38MB
66a3e670c5b5: Loading layer [==================================================>]  15.58MB/15.58MB
9cdd51a1e20c: Loading layer [==================================================>]  15.36kB/15.36kB
9aedba3496f1: Loading layer [==================================================>]  15.58MB/15.58MB
Loaded image: goharbor/harbor-adminserver:v1.6.1


[Step 2]: preparing environment ...
Generated and saved secret to file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/registryctl/env
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.


[Step 3]: checking existing instance of Harbor ...


[Step 4]: starting Harbor ...
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis              ... done
Creating registry           ... done
Creating harbor-adminserver ... done
Creating harbor-db          ... done
Creating harbor-ui          ... done
Creating nginx              ... done
Creating harbor-jobservice  ... done

✔ ----Harbor has been installed and started successfully.----

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

启动成功

你可能感兴趣的:(linux,bash,容器,运维)