rocky9上安装Harbor私有仓库
环境
rocky9 minimal
安装docker
配置阿里云的docker源
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
指定安装这个版本的docker-ce
yum list docker-ce --showduplicates | sort -r
yum -y install docker-ce-24.0.7-1.el9
启动docker
cat << EOF > /etc/docker/daemon.json
{
“registry-mirrors”: [“http://hub-mirror.c.163.com”]
}
EOF
systemctl daemon-reload
systemctl enable --now docker
安装docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.23.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version #查看版本
下载harbor离线安装包
wget https://mirror.ghproxy.com/https://github.com/goharbor/harbor/releases/download/v2.10.0/harbor-offline-installer-v2.10.0.tgz
tar -xf harbor-offline-installer-v2.10.0.tgz
配置安装
cd harbor
证书
mkdir myCerts
cd myCerts/
# ca证书
openssl genrsa -out ca.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 -subj "/CN=huahuayun.cloud" -key ca.key -out ca.crt
# 服务器证书
openssl genrsa -out server.key 4096
openssl req -new -sha512 -subj "/CN=huahuayun.cloud" -key server.key -out server.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=dns.huahuayun.com
DNS.2=223.5.5.5
DNS.3=192.168.2.210
EOF
openssl x509 -req -sha512 -days 3650 -extfile v3.ext -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt
# 查看证书到期时间
openssl x509 -in server.crt -noout -text
配置
cd …
cp harbor.yml.tmpl harbor.yml
修改harbor.yml,比如https的端口、hostname、harbor_admin_password、data_volume
比如注释掉https
执行安装
./install.sh
docker-compse ps 查看harbor启动情况
cd harbor
#docker-compose down #停止
#docker-compose up -d #启动
登录❥(^_-)
podman登录
在客户端配置
cat > /etc/containers/registries.conf.d/myregistry.conf << EOF
[[registry]]
location = "hub.huahuayun.cloud"
insecure = true
EOF
podman login http://hub.huahuayun.cloud -u admin -p Harbor12345
podman login --tls-verify=false hub.huahuayun.cloud
docker登录
docker login http://hub.huahuayun.cloud -u admin -p Harbor12345
原文地址:https://blog.csdn.net/OldHusband/article/details/137644630
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!