您的位置:首页 > 游戏 > 手游 > 烟台互联网公司有哪些_聚名网抢注_广告公司推广渠道_成都新站软件快速排名

烟台互联网公司有哪些_聚名网抢注_广告公司推广渠道_成都新站软件快速排名

2025/5/4 22:40:53 来源:https://blog.csdn.net/lovely_nn/article/details/131592785  浏览:    关键词:烟台互联网公司有哪些_聚名网抢注_广告公司推广渠道_成都新站软件快速排名
烟台互联网公司有哪些_聚名网抢注_广告公司推广渠道_成都新站软件快速排名

一、 安装的前提条件

硬件

资源

最低

推荐

cpu2C4C
内存4G8G
硬盘40G160G

软件

软件

版本

描述

dockerv17.0.6-ce+

安装参考官方文档

Install Docker Engine | Docker Documentation

docker-composev1.18.0+

安装参考官方文档

Overview | Docker Documentation

Openssllatest用于为harbor生成证书和密钥

二、安装配置

生成harbor自签证书和密钥

docker 在docker login 时默认使用 https 的方式连接到镜像仓库,修改docker连接方式需要重启docker,生产环境不允许,所以要提前为harbor 准备证书和密钥。

1.生成 CA 证书私钥

$ openssl genrsa -out ca.key 1024

2.生成 CA 证书

$ openssl req -x509 -new -nodes -sha512 -days 3650  -subj "/C=US/ST=TestState/L=TestCity/O=TestOrg/OU=TestOU/CN=Test"  -key ca.key  -out ca.crt

3.生成私钥

$ openssl genrsa -out svt.harbor.com.key 1024

4.生成证书签名请求

$ openssl req -sha512 -new \-subj "/C=US/ST=TestState/L=TestCity/O=TestOrg/OU=TestOU/CN=Test" \-key svt.harbor.com.key \-out svt.harbor.com.csr

5.生成 x509 v3扩展文件

$ cat v3.ext 
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names[alt_names]
DNS.1=test.harbor.com
DNS.2=test.harbor
DNS.3=harbor

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

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

7.提供证书给Harbor和Docker

将服务器的证书和密钥复制到harbor主机证书文件夹中(/etc/docker/certs.d/)

将crt文件 解释为CA证书(cert)

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

将服务器证书、密钥和CA文件复制到Docker证书文件夹中

$ cp test.harbor.com.cert /etc/docker/certs.d/test.harbor.com/
$ cp test.harbor.com.key /etc/docker/certs.d/test.harbor.com/
$ cp ca.crt /etc/docker/certs.d/test.harbor.com/
安装配置Harbor

安装目录为 /opt/harbor 目录

1. 将离线安装包mv至安装目录并解压

$ mv /tmp/harbor-offline-installer-v2.3.5.tgz /opt/harbor
$ cd /opt/harbor && tar -vxf harbor-offline-installer-v2.3.5.tgz
harbor/harbor.v2.3.5.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl

2.copy原来的配置文件harbor.yml.tmpl 为harbor.yml,并修改harbor的配置文件

$ cd harbor && cp harbor.yml.tmpl harbor.yml

修改的地方有:

$ vim harbor.yml
hostname: test.harbor.com
http:port: 80
https:port: 443certificate: /path/test.harbor.com.certprivate_key: /path/test.harbor.com.key
harbor_admin_password: xxxxx
database:password: xxxxx
data_volume: /opt/harbor/data

3.修改完后启动harbor,配置文件修改后都得先执行 ./prepare 安装执行 ./install

$ ./prepare
$ ./install

docker-compose 常用命令

# docker-compose 命令需要在模板文件(docker-compose.yml)所在目录执行才有效
docker-compose up -d      # 启动服务(后台运行)
docker-compose start      # 启动服务
docker-compose stop       # 停止正在运行的服务
docker-compose down       # 停止和删除容器、网络、卷、镜像等(参数 -v 会将数据卷一起删除)
docker-compose restart    # 重启服务
docker-compose ps         # 查看服务
docker-compose top        # 查看服务中运行的进程

三、Harbor 加入开机自启

$ vim /usr/lib/systemd/system/harbor.service
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
[Service]
Type=simple
Restart=on-failure
RestartSec=5
# docker-compose.yml文件为harbor启动文件,应使用绝对路径
ExecStart=/bin/docker-compose -f /opt/harbor/harbor/docker-compose.yml up -d
ExecStop=/bin/docker-compose -f /opt/harbor/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target$ chmod +x  /usr/lib/systemd/system/harbor.service
$  systemctl daemon-reload
$  systemctl start harbor
$  systemctl enable harbor
$  systemctl status harbor

四、测试连接Harbor私有仓库

不建议添加为Docker私有仓库地址,因为需要重启docker才可生效,要登录harbor仓库中时可进行以下操作:

$ vim /etc/hosts
10.40.x.x test.harbor.com
$ docker login svt.harbor.com
$ docker pull images

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com