Installation harbor-2.6.2 on CentOS 8.3

一、Installation harbor-2.6.2 on CentOS 8.3

1 地址

2 Harbor 安装条件

部署Harbor的最低硬件和软件配置:https://goharbor.io/docs/2.0.0/install-config/installation-prereqs

2.1 Hardware

The following table lists the minimum and recommended hardware configurations for deploying Harbor.

Resource Minimum Recommended
CPU 2 CPU 4 CPU
Mem 4 GB 8 GB
Disk 40 GB 160 GB

2.2 Software

The following table lists the software versions that must be installed on the target host.

Software Version Description
Docker engine Version 17.06.0-ce+ or higher For installation instructions, see Docker Engine documentation
Docker Compose Version 1.18.0 or higher For installation instructions, see Docker Compose documentation
Openssl Latest is preferred Used to generate certificate and keys for Harbor

2.3 Network ports

Harbor requires that the following ports be open on the target host.

Port Protocol Description
443 HTTPS Harbor portal and core API accept HTTPS requests on this port. You can change this port in the configuration file.
4443 HTTPS Connections to the Docker Content Trust service for Harbor. Only required if Notary is enabled. You can change this port in the configuration file.
80 HTTP Harbor portal and core API accept HTTP requests on this port. You can change this port in the configuration file.

3 docker 和 docker-compose 安装在底部!

 

二、离线安装 Harbor

1 wget 下载

mkdir /opt/software && cd /opt/software
wget https://github.com/goharbor/harbor/releases/download/v2.6.2/harbor-offline-installer-v2.6.2.tgz

2 解压

tar -zxvf /opt/software/harbor-offline-installer-v2.6.2.tgz -C /opt && cd /opt/harbor && ll
total 774M
-rw-r--r-- 1 root root 3.6K Nov  9 17:35 common.sh
-rw-r--r-- 1 root root 774M Nov  9 17:36 harbor.v2.6.2.tar.gz
-rw-r--r-- 1 root root  11K Nov  9 17:35 harbor.yml.tmpl
-rwxr-xr-x 1 root root 3.1K Nov  9 17:35 install.sh
-rw-r--r-- 1 root root  12K Nov  9 17:35 LICENSE
-rwxr-xr-x 1 root root 1.9K Nov  9 17:35 prepare

最主要的是 harbor.yml.tmpl和 install.sh ,分别是配置文件和安装执行文件。

3 修改配置文件

# 备份一下
cp /opt/harbor/harbor.yml.tmpl /opt/harbor/harbor.yml

# 修改配置文件
vim /opt/harbor/harbor.yml
5 hostname: 192.168.80.5
10 port: 8084
34 harbor_admin_password: root
39 password: root123
47 data_volume: /opt/harbor/data
131 location: /var/log/harbor

# 创建数据和日志目录
mkdir /opt/harbor/data
mkdir /var/log/harbor

4 修改daemon

添加http的通信地址,docker默认使用https进行通信,如果配置了https协议就不需要添加。

cat > /etc/docker/daemon.json << EOF
{
    "registry-mirrors": [
      "https://registry.docker-cn.com",
      "https://docker.mirrors.ustc.edu.cn",
      "https://dockerhub.azk8s.cn",
      "http://hub-mirror.c.163.com"
    ],
    "experimental": true,
    "exec-opts": ["native.cgroupdriver=systemd"],
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "100m"
    },
    "insecure-registries": ["192.168.80.5:8084"]
}
EOF

5 重新加载配置和重启docker

systemctl daemon-reload && systemctl restart docker

6 执行部署脚本

/opt/harbor/install.sh

## 查看进程
ps -ef |grep harbor

## 查看镜像
docker images

## 查看镜像启动
docker ps -a

7 登陆 Harbor

服务器 IP:8084

默认用户名:admin 密码:root

8 命令行登陆 docker

docker info
docker login 192.168.80.5:8084

三、测试上传和下载

1 项目--->新建项目--->项目名称--->镜像仓库

2 对需要推送的镜像签名

docker pull tomcat
docker images

# tomcat镜像设置标签
docker tag tomcat:latest 192.168...:8084/iyuyixyz/tomcat:latest
docker push 192.168...:8084/iyuyixyz/tomcat:latest

 

四、harbor的停止与启动

cd /opt/harbor
## 停止
docker-compose stop
## 启动(第一次需要使用 up -d)
docker-compose start

# 如果 Harbor 已在运行,请停止并删除现有实例。
## 数据保留在文件系统中(慎用)
docker-compose down
# 创建并启动
docker-compose up -d

 

X、One Step Success

 

Y、Error message

绑定源路径不存在

Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/log/harbor/

解决

mkdir /var/log/harbor/

 

Z、Related Links

Installation docker-20.10.12 on CentOS 7.9:https://www.cnblogs.com/huaxiayuyi/p/16775236.html

Installation docker-compose on CentOS 7.9:https://www.cnblogs.com/huaxiayuyi/p/16775728.html

Installation harbor-2.6.2 on openEuler:https://www.cnblogs.com/huaxiayuyi/p/16897413.html

 

posted @ 2022-11-15 21:24  娇小赤雅  阅读(151)  评论(0编辑  收藏  举报