CentOS7 安装Harbor2.5.1

355 阅读1分钟

Harbor官网

image.png

点击Getting Started,点击1. Download the Harbor Installer,1. Go to the Harbor releases page.

image.png

1,CentOS7安装docker server

2,安装docker-compose(1.18.0+)

docker-compose地址,点击release page,本次安装docker-compose-linux-x86_64

image.png

安装compose

#上传至/usr/local/bin/
[root@logs2 harbor]# cd /usr/local/bin/
[root@logs2 bin]# ll
total 74916
-rw-r--r-- 1 root root 25968640 Jun 13 20:30 docker-compose-linux-x86_64

# 更改名称
[root@logs2 bin]# mv docker-compose-linux-x86_64 docker-compose
#更改权限
[root@logs2 bin]# chmod 777 docker-compose 
#版本
[root@logs2 bin]# ./docker-compose -v
Docker Compose version v2.6.0


配置环境变量

# vim /etc/profile

#add
PATH=$PATH:$HOME/bin:/usr/local/bin
#在该语句之前增加一行
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

#保存退出

使环境变量生效

source /etc/profile

3,安装 Harbor

本次安装harbor-online-installer-v2.5.1.tgz

上传服务器

#移至/home目录
[root@logs2 home]# ll
total 1044
-rw-r--r-- 1 root          root            10205 Jun 13 20:17 harbor-online-installer-v2.5.1.tgz

## 解压
[root@logs2 home]# tar -zxvf harbor-online-installer-v2.5.1.tgz 

配置harbor.yml

[root@logs2 home]# cp harbor/harbor.yml.tmpl harbor/harbor.yml
[root@logs2 home]# vim harbor/harbor.yml

#你服务器得ip
hostname: 172.16.xx.xx

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 8081
  
  
#保存退出

启动

[root@logs2 home]# harbor/./install.sh

错误1

ERROR:root:Error: The protocol is https but attribute ssl_cert is not set

解决1

#注释掉https配置
#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

## 再次启动
[root@logs2 home]# harbor/./install.sh

 ⠿ Network harbor_harbor        Created                                                                                                                                                                                    0.0s
 ⠿ Container harbor-log         Started                                                                                                                                                                                    0.7s
 ⠿ Container redis              Started                                                                                                                                                                                    1.4s
 ⠿ Container harbor-portal      Started                                                                                                                                                                                    1.4s
 ⠿ Container registry           Started                                                                                                                                                                                    1.3s
 ⠿ Container registryctl        Started                                                                                                                                                                                    1.2s
 ⠿ Container harbor-db          Started                                                                                                                                                                                    1.2s
 ⠿ Container harbor-core        Started                                                                                                                                                                                    1.5s
 ⠿ Container nginx              Started                                                                                                                                                                                    1.9s
 ⠿ Container harbor-jobservice  Started                                                                                                                                                                                    1.8s
✔ ----Harbor has been installed and started successfully.----

验证

默认 admin/Harbor12345

http://你的ip:port/

image.png