安装harbor之前需要安装docker-compost
1、下载harbor压缩包
wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.1-rc1.tgz
2、下成功后解压
tar -zxvf harbor-offline-installer-v1.9.1-rc1.tgz
3、解压后进入harbor 编辑 harbor.yml 配置文件
修改 hostname 为主机ip或域名
端口号看情况修改(我修改为8080了,避免和nginx冲突)
harbor_admin_password 为admin的密码
配置文件 harbor.yml
hostname: **.***.**.** # 这里配置的监听地址,可以是域名
http:
port: 8080 # 端口
harbor_admin_password: Harbor # 配置admin用户的密码
database: # 配置数据库相关的信息
password: root123 # 数据库密码
max_idle_conns: 50
max_open_conns: 100
data_volume: /data # 镜像存放的目录
clair:
updaters_interval: 12
jobservice:
max_job_workers: 10
notification:
webhook_job_max_retry: 10
chart:
absolute_url: disabled
log:
level: info
local:
rotate_count: 50
rotate_size: 200M
location: /var/log/harbor # 日志目录
_version: 1.9.0
proxy:
http_proxy:
https_proxy:
no_proxy: 127.0.0.1,localhost,.local,.internal,log,db,redis,nginx,core,portal,postgresql,jobservice,registry,registryctl,clair
components:
- core
- jobservice
- clair
4、安装harbor 运行可执行文件
./install.sh
执行输出:
[root@iZbp11s2mtszc5s9uaakklZ harbor]# ./install.sh
[Step 0]: checking installation environment ...
Note: docker version: 19.03.13
Note: docker-compose version: 1.24.1
[Step 1]: loading Harbor images ...
Loaded image: goharbor/redis-photon:v1.9.1
Loaded image: goharbor/registry-photon:v2.7.1-patch-2819-2553-v1.9.1
Loaded image: goharbor/harbor-registryctl:v1.9.1
Loaded image: goharbor/clair-photon:v2.0.9-v1.9.1
Loaded image: goharbor/harbor-migrator:v1.9.1
Loaded image: goharbor/chartmuseum-photon:v0.9.0-v1.9.1
Loaded image: goharbor/prepare:v1.9.1
Loaded image: goharbor/harbor-db:v1.9.1
Loaded image: goharbor/notary-server-photon:v0.6.1-v1.9.1
Loaded image: goharbor/harbor-jobservice:v1.9.1
Loaded image: goharbor/nginx-photon:v1.9.1
Loaded image: goharbor/notary-signer-photon:v0.6.1-v1.9.1
Loaded image: goharbor/harbor-portal:v1.9.1
Loaded image: goharbor/harbor-core:v1.9.1
Loaded image: goharbor/harbor-log:v1.9.1
[Step 2]: preparing environment ...
prepare base dir is set to /usr/src/harbor
Clearing the configuration file: /config/registry/root.crt
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/config.yml
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/nginx/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/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
loaded secret from file: /secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating redis ... done
Creating registryctl ... done
Creating harbor-db ... done
Creating registry ... done
Creating harbor-core ... 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://**.***.**.**.
For more details, please visit https://github.com/goharbor/harbor .
5、安装成功后访问 http://ip:8080/ 输入账户密码登录