【原创笔记】CICD系列之三:goharbor安装

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 [email protected]:/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

你可能感兴趣的:(devops)