Harbor安装

首先关闭SELINUX

其次开放http/https防火墙协议

yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
systemctl enable docker && systemctl start docker
ll -t

自行官网下载

wget http://server.thefunc.com/download/harbor-offline-installer-v2.7.1.tgz
tar -xvzf harbor-offline-installer-v2.7.1.tgz -C /srv
cd /srv/harbor
ls
docker load -i harbor.v2.7.1.tar.gz
cp harbor.yml.tmpl harbor.yml

harbor.yml 修改hostname为指定服务名(服务名为外部客户端访问所能访问的地址)

hostname

修改hostname为当前主机名

vi harbor.yml
hostname: harbor.thefunc.com
harbor_admin_password: 666666
# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: 666666

SSL配置

https://goharbor.io/docs/1.10/install-config/configure-https/

mkdir -p /srv/harbor/cert && cd /srv/harbor/cert
openssl genrsa -out ca.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 \
 -subj "/C=CN/ST=GD/L=GZ/O=GGEC/OU=IT/CN=harbor.thefunc.com" \
 -key ca.key \
 -out ca.crt
openssl genrsa -out harbor.thefunc.com.key 4096
openssl req -sha512 -new \
    -subj "/C=CN/ST=GD/L=GZ/O=GGEC/OU=IT/CN=harbor.thefunc.com" \
    -key harbor.thefunc.com.key \
    -out harbor.thefunc.com.csr

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

[alt_names]
DNS.1=harbor.thefunc.com
DNS.2=192.168.199.179
DNS.3=REDHAT7-Docker-Harbor-ImageService
EOF
openssl x509 -req -sha512 -days 3650 \
    -extfile v3.ext \
    -CA ca.crt -CAkey ca.key -CAcreateserial \
    -in harbor.thefunc.com.csr \
    -out harbor.thefunc.com.crt
openssl x509 -inform PEM -in harbor.thefunc.com.crt -out harbor.thefunc.com.cert
mkdir -p /etc/docker/certs.d/harbor.thefunc.com
cp harbor.thefunc.com.cert /etc/docker/certs.d/harbor.thefunc.com/
cp harbor.thefunc.com.key /etc/docker/certs.d/harbor.thefunc.com/
cp ca.crt /etc/docker/certs.d/harbor.thefunc.com/
systemctl restart docker

修改harbor配置

# https related config
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /srv/harbor/cert/harbor.thefunc.com.crt
  private_key: /srv/harbor/cert/harbor.thefunc.com.key

安装

./prepare
./install.sh

打开网址访问

https://harbor.thefunc.com

超级密码 666666

Hits: 4203

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据