harbor 2.1.0离线安装

之前安装过harbor 1.12,所以,安装2.1.0,也就轻车熟路了。前提当然是先安装好docker及docker-compose哟~

一,下载

https://github.com/goharbor/harbor/releases/tag/v2.1.0

要是github上下载慢的话,我提供一个百度网盘:
链接:https://pan.baidu.com/s/1ir526Teht9-Q5IaREI3kug
提取码:yjih
复制这段内容后打开百度网盘手机App,操作更方便哦

二,解压

下载完成,上传服务器,解压。

drwxr-xr-x. 3 root root        20 Oct 26 22:33 common
-rw-r--r--. 1 root root      3361 Sep 16 10:48 common.sh
-rw-r--r--. 1 root root      5978 Oct 26 22:33 docker-compose.yml
-rw-r--r--. 1 root root 558317240 Sep 16 10:49 harbor.v2.1.0.tar.gz
-rw-r--r--. 1 root root      8136 Oct 26 22:33 harbor.yml
-rw-r--r--. 1 root root      8136 Sep 16 10:48 harbor.yml.tmpl
-rwxr-xr-x. 1 root root      2523 Sep 16 10:48 install.sh
-rw-r--r--. 1 root root     11347 Sep 16 10:48 LICENSE
-rwxr-xr-x. 1 root root      1881 Sep 16 10:48 prepare

三,调整配置

从harbor.yml.tmpl复制一个harbor.yml,然后修改前面几行,自定义Hostname,port,禁用https,设置管理员密码。

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.1.212

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 8089

# https related config
#https:
  # https port for harbor, default is 443
#  port: 443
  # The path of cert and key files for nginx
#  certificate: /your/certificate/path
#  private_key: /your/private/key/path

# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal

# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433

# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: password

2020-10-26 22_40_01-212 - root@k3s-agent_~_software_harbor - Xshell 6 (Free for Home_School).png

四,安装并启动

./install.sh

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

Note: docker version: 19.03.13

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

Note: docker-compose version: 1.27.4

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


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/software/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
loaded secret from file: /data/secret/keys/secretkey
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 harbor-log ... done
Creating redis         ... done
Creating harbor-portal ... done
Creating registry      ... done
Creating registryctl   ... done
Creating harbor-db     ... done
Creating harbor-core   ... done
Creating nginx             ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.----

五,登陆

主题深浅随意~


2020-10-26 22_41_47-Harbor.png

六,其它命令

主要通过docker-compose管理的,所以通过docker-compose -h就可以了解harbor的日常启停命令。

七,更改管理员密码

新版的harbor 2.0版本加密方式采用sha256,网上找的其它1版本的更改不合适了。这里找了一个新版的方法,作个记录。
1,进入harbor的数据库容器
docker exec -it harbor-db /bin/bash
2,进入postgres命令行

psql -h postgresql -d postgres -U postgres  #这要输入默认密码:root123 。
psql -U postgres -d postgres -h 127.0.0.1 -p 5432  #或者用这个可以不输入密码。

3,切换到harbor所在的数据库
\c registry
4,查看harbor_user表
select * from harbor_user;
5,重置admin用户密码为Harbor12345
update harbor_user set password='c999cbeae74a90282c8fa7c48894fb00', salt='nmgxu7a5ozddr0z6ov4k4f7dgnpbvqky' where username='admin';
6,退出

\q     退出postgresql
exit  退出容器

7,接下来,就可以通过WEBUI登陆admin(admin/Harbor12345)用户,进行密码更新了。

你可能感兴趣的:(harbor 2.1.0离线安装)