软件版本要求

Docker engine:17.06.0-ce或更高 (Docker version 20.10.2)
Docker Compose:1.18.0或更高(注意:这里选择1.25.若最新的1.28.缺省centos7.6系列的glibc包版本过低不支持,需要另外安装。升级会影响其它使用的系统这个文件的组件)
相关路径:
安装目录:/data/harbor
数据路径:/data/harbor/data
日志路径:/data/harbor/log/harbor

本文以CentOS7为例来安装Harbor

1、安装依赖
yum install yum-utils device-mapper-persistent-data lvm2
2、安装docker-ce
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
systemctl enable docker
systemctl start docker
docker --version
Docker version 20.10.2, build 2291f61

3、安装docker-compose
wget https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64
mv docker-compose-Linux-x86_64 /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
docker-compose --version
docker-compose version 1.25.0, build 0a186604
4、下载harbor离线安装包
wget https://github.com/goharbor/harbor/releases/download/v2.1.3/harbor-offline-installer-v2.1.3.tgz
tar xf https://github.com/goharbor/harbor/releases/download/v2.1.3/harbor-offline-installer-v2.1.3.tgz
cp harbor /xqxc

5、配置harbor
建立配置文件
cp harbor.yml.tmpl harbor.yml
此处为本机IP
sed -i "s#reg.mydomain.com#192.168.10.2#g" harbor/harbor.yml
sed -i "s#arbor12345#密码#g" harbor/harbor.yml
sed -i "s#data_volume: /data#data_volume: /data/harbor/data#g" harbor/harbor.yml
sed -i "s#location: /var/log/harbor#location: /data/harbor/log/harbor#g harbor/harbor.yml

6、安装harbor

注意:--with-clair参数是启用漏洞扫描功能,相关内容请查看官方文档:https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md

./harbor/install.sh --with-clair
[root@nexus_harbor_openvpn harbor]# ./install.sh --with-clair

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.2

[Step 1]: checking docker-compose is installed ...

Note: docker-compose version: 1.25.0

[Step 2]: loading Harbor images ...
Loaded image: goharbor/trivy-adapter-photon:v2.1.3
Loaded image: goharbor/prepare:v2.1.3
Loaded image: goharbor/harbor-log:v2.1.3
Loaded image: goharbor/redis-photon:v2.1.3
Loaded image: goharbor/nginx-photon:v2.1.3
Loaded image: goharbor/notary-signer-photon:v2.1.3
Loaded image: goharbor/clair-photon:v2.1.3
Loaded image: goharbor/harbor-portal:v2.1.3
Loaded image: goharbor/harbor-core:v2.1.3
Loaded image: goharbor/harbor-registryctl:v2.1.3
Loaded image: goharbor/registry-photon:v2.1.3
Loaded image: goharbor/chartmuseum-photon:v2.1.3
Loaded image: goharbor/harbor-db:v2.1.3
Loaded image: goharbor/harbor-jobservice:v2.1.3
Loaded image: goharbor/notary-server-photon:v2.1.3
Loaded image: goharbor/clair-adapter-photon:v2.1.3

[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /xqxc/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /config/clair/postgres_env
Generated configuration file: /config/clair/config.yaml
Generated configuration file: /config/clair/clair_env
Generated configuration file: /config/clair-adapter/env
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir

[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating network "harbor_harbor-clair" with the default driver
Creating harbor-log ... done
Creating registryctl ... done
Creating registry ... done
Creating harbor-portal ... done
Creating harbor-db ... done
Creating redis ... done
Creating harbor-core ... done
Creating clair ... done
Creating clair-adapter ... done
Creating nginx ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.----

7、验证

至此安装完成,访问http://192.168.10.2:8010/验证,账号admin 密码:xxx

最后修改日期:2021年1月22日

作者

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。