关于devops:原创笔记CICD系列之三goharbor安装

5次阅读

共计 1371 个字符,预计需要花费 4 分钟才能阅读完成。

CICD 系列之三:goharbor 装置

筹备主机:10.0.0.14

将 Harbor 装置在 linux 上。在装置 Harbor 之前,必须确保机器上曾经装置了 docker 17.06.0-ce+ 和 docker-compose 1.18.0+。

1. 降级 docker(按需)

wget https://download.docker.com/l…
yum -y install docker-ce-17.06.2.ce-1.el7.centos.x86_64.rpm

2. 下载在线安装包

wget https://github.com/goharbor/h…

3. 配置 SSL 证书

创立证书寄存目录

mkdir -p /data/cert && cd /data/cert

生成根证书私钥(无加密)

openssl genrsa -out ca.key 2048
openssl req -x509 -new -nodes -key ca.key -days 10000 -out ca.crt -subj “/CN=Harbor-sz”

生成服务器端私钥和 CSR 签名申请

openssl req -newkey rsa:4096 -nodes -sha256 -keyout server.key -out server.csr

签发服务器证书

echo subjectAltName = IP:10.0.0.14 > extfile.cnf
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -extfile extfile.cnf -out server.crt

4. 批改配置文件

tar -xvf harbor-online-installer-v1.10.0.tgz
cd harbor
vi harbor.yml


hostname: 10.0.0.14
https:
##### https port for harbor, default is 443
port: 443
##### The path of cert and key files for nginx
certificate: /data/cert/server.crt
private_key: /data/cert/server.key

5. 装置

./install.sh

6. 拜访 https://10.0.0.14:443/

admin/Harbor12345

7. 登录 registry

解决 x509 问题

mkdir -p /etc/docker/certs.d/10.0.0.14
cd /data/cert
cp ca.crt /etc/docker/certs.d/10.0.0.14

非 10.0.0.14 的其余机器

mkdir -p /etc/docker/certs.d/10.0.0.14
scp root@10.0.0.14:/data/cert/ca.crt /etc/docker/certs.d/10.0.0.14

systemctl restart docker

8. 验证装置

docker login -u admin -p testpass0 10.0.0.14
docker tag busybox:latest 10.0.0.14/library/busybox:latest
docker push 10.0.0.14/library/busybox:latest
docker logout 10.0.0.14

正文完
 0