环境:

ubuntu版本:ubuntu~18.04.1

docker版本:  docker-19.03.8

docker-compose版本:1.25.4

--------------------------------------------------------------------------------------------------------------

软件包:harbor-offline-installer-v1.10.1.tgz

将软件包上传到/opt目录下

--------------------------------------------------------------------------------------------------------------

安装步骤:

1.关闭防火墙

ufw disable

2. 修改host文件

vi /etc/hosts

 

harbro需要域名访问,我们在hosts文件中加入

192.168.1.201 harbor.com

这里到ip是主机IP地址,根据实际情况填写

3.生成自签名证书

mkdir /root/certs.d
cd /root/certs.d

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

 

openssl genrsa -out ca.key 4096

3.2生成自签名证书(使用已有私钥ca.key自行签发根证书)生成ca.crt:

 

openssl req -x509 -new -nodes -sha512 -days 3650 \
    -subj "/C=CN/ST=Beijing/L=Beijing/O=ccx/OU=plat/CN=192.168.1.201" \
    -key ca.key \
    -out ca.crt

 3.3生成服务器端自己域名的key

openssl genrsa -out harbor.com.key 4096

3.4生成服务器端自己域名的CSR签名请求

 

openssl req -sha512 -new \
    -subj "/C=CN/ST=Beijing/L=Beijing/O=ccx/OU=plat/CN=192.168.1.201" \
    -key harbor.com.key \
    -out harbor.com.csr

3.5生成一个 openssl 命令需要的外部配置文件 externalfile.ext

这个文件可以随意命名,但是要记住,后面对的命令还要用到。、

文件内容中主要是subjectAltName这一项

如果配IP就写IP.1=192.168.xxx.xxx

如果配域名就写 DNS.1=xxx.xxx.com

cat >  externalfile.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth 
subjectAltName = @alt_names
[alt_names]
DNS.1=harbor.com
EOF

 

3.6通过外部配置文件 externalfile.ext和 csr 生成 crt:

 

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

3.7将服务端的 crt 转换成客户端用的 cert:

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

至此,所有证书文件就创建好了

 

 4.安装harbor

cd /opt
tar -zxvf harbor-offline-installer-v1.10.1.tgz
cd harbor
vi harbor.yml

配置文件根据实际修改

hostname:harbor.com

https.cartificate:/root/certs.d/harbor.com.crt

https.private_key:/root/certs.d/harbor.com.key

harbor_admin_password: 123456

datebase.password:123456

data_volume: /root/harbor/data

更新参数:./prepare

进行安装:./install.sh

 

 

安装完成后打开浏览器可以访问harbor的ui界面

 

https:192.168.1.201:44

----------------------------------------------------------

docker登陆方法:

1首先自己的机器要在hosts文件中加入192.168.1.201 harbor.com

2在/etc/docker/docker.json中加入

  "insecure-registries": [
    "harbor.com"
  ]

以项目library为例:

docker login harbor/library

输入用户名和密码即可登陆成功

 

 

 

GitHub 加速计划 / ha / harbor
23.24 K
4.67 K
下载
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
最近提交(Master分支:1 个月前 )
c5d26723 chore(deps): bump github.com/go-openapi/runtime in /src Bumps [github.com/go-openapi/runtime](https://github.com/go-openapi/runtime) from 0.26.2 to 0.28.0. - [Release notes](https://github.com/go-openapi/runtime/releases) - [Commits](https://github.com/go-openapi/runtime/compare/v0.26.2...v0.28.0) --- updated-dependencies: - dependency-name: github.com/go-openapi/runtime dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: miner <yminer@vmware.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shengwen YU <yshengwen@vmware.com> Co-authored-by: miner <yminer@vmware.com> 14 天前
76624373 chore(deps): bump github.com/coreos/go-oidc/v3 in /src Bumps [github.com/coreos/go-oidc/v3](https://github.com/coreos/go-oidc) from 3.10.0 to 3.11.0. - [Release notes](https://github.com/coreos/go-oidc/releases) - [Commits](https://github.com/coreos/go-oidc/compare/v3.10.0...v3.11.0) --- updated-dependencies: - dependency-name: github.com/coreos/go-oidc/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shengwen YU <yshengwen@vmware.com> Co-authored-by: miner <yminer@vmware.com> 14 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐