#生成私钥 openssl genrsa -des3 -out server.key 2048 Generating RSA private key, 2048 bit long modulus ...............................................................+++ ......+++ e is 65537 (0x10001) Enter pass phrase for server.key: 123456 Verifying - Enter pass phrase for server.key: 123456
## 创建证书请求CSR openssl genrsa -des3 -out server.key 2048 Generating RSA private key, 2048 bit long modulus ...............................................................+++ ......+++ e is 65537 (0x10001) Enter pass phrase for server.key: Verifying - Enter pass phrase for server.key: [root@Centos7 cert]# openssl req -new -key server.key -out server.csr Enter pass phrase for server.key: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:CN # 国家名 State or Province Name (full name) []:ShangHai # 省份 Locality Name (eg, city) [Default City]:ShangHai # 市 Organization Name (eg, company) [Default Company Ltd]:nues.cn # 组织 Organizational Unit Name (eg, section) []:nnv5.cn # 机构 Common Name (eg, your name or your server's hostname) []:hub.nues.cn # 完全合格域名 Email Address []:admin@nues.cn # 管理员邮箱 Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: # 是否改密码直接回车 An optional company name []: # 是否改密码直接回车 # 备份私钥 cp server.key server.key.org #去除私钥密码 openssl rsa -in server.key.org -out server.key Enter pass phrase for server.key.org: 123456 # 前面设置的私钥密码 writing RSA key # 将证书签名 openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt Signature ok subject=/C=CN/ST=s\x08SHANGHAI/L=SHANGHAI/O=nues.cn/OU=nues.cn/CN=hub.nues.cn/emailAddress=admin@nues.cn Getting Private key # 将证书赋予执行权限 chmod +x server.*
安装harbor并启动harbor服务
cd /data/harbor/ ./install.sh #结果如下 [root@harbor harbor]# ./install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 24.0.7
[Step 1]: checking docker-compose is installed ...
[Step 4]: preparing harbor configs ... prepare base dir is set to /data/harbor Generated configuration file: /config/log/logrotate.conf Generated configuration file: /config/log/rsyslog_docker.conf Generated configuration file: /config/nginx/nginx.conf Generated configuration file: /config/core/env Generated configuration file: /config/core/app.conf Generated configuration file: /config/registry/config.yml Generated configuration file: /config/registryctl/env Generated configuration file: /config/db/env Generated configuration file: /config/jobservice/env Generated configuration file: /config/jobservice/config.yml Generated and saved secret to file: /secret/keys/secretkey Generated certificate, key file: /secret/core/private_key.pem, cert file: /secret/registry/root.crt Generated configuration file: /compose_location/docker-compose.yml Clean up the input dir
[Step 5]: starting Harbor ... [+] Running 10/10 ⠿ Network harbor_harbor Created 0.4s ⠿ Container harbor-log Started 0.5s ⠿ Container harbor-portal Started 0.9s ⠿ Container redis Started 1.1s ⠿ Container registry Started 1.2s ⠿ Container registryctl Started 1.0s ⠿ Container harbor-db Started 1.0s ⠿ Container harbor-core Started 1.3s ⠿ Container harbor-jobservice Started 1.6s ⠿ Container nginx Started 1.7s ✔ ----Harbor has been installed and started successfully.---- #成功安装