Bootstrap

centos7.9安装harbor-offline-installer-v2.4.1.tgz

1.首先下载安装包

可以去github上搜索下载:

GitHub: Let’s build from here · GitHub

 

 

 

然后选择版本进行下载,一般从githut上下载速度很慢,我已提前下载好,从csdn上下载会比较快:

harbor-offline-installer-v2.4.1.tgz:

https://download.csdn.net/download/fyihdg/87371452https://download.csdn.net/download/fyihdg/87371452harbor-offline-installer-v2.6.3.tgz

https://download.csdn.net/download/fyihdg/87371457https://download.csdn.net/download/fyihdg/873714572.配置

修改上hosts文件

echo "192.168.0.67 harbor103.com" >> /etc/hosts

创建存放证书的目录
mkdir -p /data/cert
cd /data/cert

生成服务器证书,生成私钥

openssl genrsa -out harbor103.com.key 4096

生成证书签名请求

openssl req -sha512 -new \
    -subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=harbor103.com" \
    -key harbor103.com.key \
    -out harbor103.com.csr
 

生成 x509 v3 扩展文件

cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names

[alt_names]
DNS.1=harbor103.com
DNS.2=harbor103
DNS.3=harbor
EOF
 

使用 v3.ext 文件为您的 Harbor 主机生成证书

openssl x509 -req -sha512 -days 3650 \
    -extfile v3.ext \
    -CA ca.crt -CAkey ca.key -CAcreateserial \
    -in harbor103.com.csr \
    -out harbor103.com.crt
 

将 harbor103.com.crt 转换为 harbor103.com.cert,供 Docker 使用

openssl x509 -inform PEM -in harbor103.com.crt -out harbor103.com.cert

将服务器证书、密钥和 CA 文件复制到 Harbor 主机上的 Docker 证书文件夹中

mkdir -p /etc/docker/certs.d/harbor103.com/
cd /data/cert
cp harbor103.com.cert /etc/docker/certs.d/harbor103.com/
cp harbor103.com.key /etc/docker/certs.d/harbor103.com/
cp ca.crt /etc/docker/certs.d/harbor103.com/
 

在操作系统级别信任证书

cp harbor103.com.crt /etc/pki/ca-trust/source/anchors/harbor103.com.crt
update-ca-trust
 

重启docker

systemctl restart docker

3.安装

解压

tar -zxvf harbor-offline-installer-v2.4.1.tgz -C /opt

cd /opt/harbor
cp harbor.yml.tmpl harbor.yml
vim harbor.yml
 

certificate: /data/cert/harbor103.com.crt
private_key: /data/cert/harbor103.com.key

 

 

        然后执行命令:

./install.sh 

 

安装成功,直接在浏览上输入

https://192.168.0.67/

 用户名admin,密码是我们刚才自定义的:harbor

输入后,可以登陆了

参考链接:

harbor私有仓库安装搭建_HYESC的博客-CSDN博客_搭建harbor私有仓库

;