1. 主机配置
主机地址 | 主机配置 | 软件版本 |
---|---|---|
10.0.90.66 | CPU:8C MEM:8GB Disk: 100GB |
Harbor v2.10.0 Docker 24.0.5 |
10.0.90.67 | CPU:8C MEM:8GB Disk: 100GB |
Harbor v2.10.0 Docker 24.0.5 |
10.0.90.68 | CPU:8C MEM:16GB Disk: 500GB |
Postgres+Redis Docker 24.0.5 |
2. 基础安装配置(前置工作可跳过)
2.1 Docker 安装教程
2.1.1 安装存储驱动
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2.1.2 添加 Docker-ce 安装仓库
sudo yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
2.1.3 查看与安装所需版本
yum list docker-ce --showduplicates | sort -r
yum -y install docker-ce
2.1.4 配置国内仓库
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","https://hub-mirror.c.163.com"],
"max-concurrent-downloads": 20,
"live-restore": true,
"max-concurrent-uploads": 10,
"debug": true,
"data-root": "/data/docker_data",
"exec-root": "/data/docker_exec",
"log-opts": {
"max-size": "100m",
"max-file": "5"
}
}
2.1.5 启动 Docker
systemctl start docker && systemctl enable docker
2.1.6 安装 docker-compose
sudo wget https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
3. 安装postgres+redis服务
3.1 docker-compose.yml
version: '3.1'
services:
db:
image: goharbor/harbor-db:v2.10.0
container_name: harbor-postgres
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
environment:
POSTGRES_PASSWORD: root123
volumes:
- /mnt/data/harbor_db/database:/var/lib/postgresql/data
ports:
- 5432:5432
redis:
image: goharbor/redis-photon:v2.10.0
container_name: harbor-redis
restart: always
cap_drop:
- ALL
cap_add:
- SETGID
- SETUID
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
volumes:
- /mnt/data/harbor_db/redis:/var/lib/redis
ports:
- 6379:6379
3.2 安装postgres+redis
docker-compose up -d
4. 安装Harbor
4.1 修改harbor.yml
以下仅为需要修改的配置
hostname: harbor.abc.com
http:
port: 30080
https:
port: 30443
certificate: /mnt/gpfs/liuhuan/cert/10932648_harbor.abc.com_nginx/harbor.abc.com.pem
private_key: /mnt/gpfs/liuhuan/cert/10932648_harbor.abc.com_nginx/harbor.abc.com.key
external_url: https://harbor.abc.com
harbor_admin_password: Harbor123456
data_volume: /mnt/harbor_data
log:
level: info
local:
rotate_count: 50
rotate_size: 200M
location: /mnt/harbor_data/log
external_database:
harbor:
host: 10.0.90.66
port: 5432
db_name: registry
username: postgres
password: root123
ssl_mode: disable
max_idle_conns: 2
max_open_conns: 0
notary_signer:
host: 10.0.90.68
port: 5432
db_name: notarysigner
username: postgres
password: root123
ssl_mode: disable
notary_server:
host: 10.0.90.68
port: 5432
db_name: notaryserver
username: postgres
password: root123
ssl_mode: disable
external_redis:
host: 10.0.90.68:6379
password:
4.2 安装harbor
./install.sh