harbor怎么安装_镜像仓库harbor的安装

环境:18.04.1-Ubuntu


安装docker


参考链接https://docs.docker.com/engine/install/ubuntu/

具体如下:

  • 更新apt & 允许使用https
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
  • 添加gpk key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • 设置稳定的安装源 (arm芯片机器执行自行参考链接原文)
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • 安装docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

使用https证书

离线环境不装这个也行

  • 下载acme配置邮箱 邮箱请替换成实际的
wget -O -  https://get.acme.sh | sh -s email=xxx@xxx.com

安装成功如下

--2021-03-19 08:05:43--  https://get.acme.sh/
Resolving get.acme.sh (get.acme.sh)... 104.21.34.62, 172.67.199.16, 2606:4700:3031::ac43:c710, ...
Connecting to get.acme.sh (get.acme.sh)|104.21.34.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘STDOUT’
-                                                               [ <=>                                                                                                                                     ]     937  --.-KB/s    in 0s      
2021-03-19 08:05:44 (25.8 MB/s) - written to stdout [937]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  204k  100  204k    0     0  4650k      0 --:--:-- --:--:-- --:--:-- 4650k
[Fri Mar 19 08:05:44 UTC 2021] Installing from online archive.
[Fri Mar 19 08:05:44 UTC 2021] Downloading https://github.com/acmesh-official/acme.sh/archive/master.tar.gz
[Fri Mar 19 08:05:45 UTC 2021] Extracting master.tar.gz
[Fri Mar 19 08:05:45 UTC 2021] It is recommended to install socat first.
[Fri Mar 19 08:05:45 UTC 2021] We use socat for standalone server if you use standalone mode.
[Fri Mar 19 08:05:45 UTC 2021] If you don't use standalone mode, just ignore this warning.
[Fri Mar 19 08:05:45 UTC 2021] Installing to /root/.acme.sh
[Fri Mar 19 08:05:45 UTC 2021] Installed to /root/.acme.sh/acme.sh
[Fri Mar 19 08:05:45 UTC 2021] Installing alias to '/root/.bashrc'
[Fri Mar 19 08:05:45 UTC 2021] OK, Close and reopen your terminal to start using acme.sh
[Fri Mar 19 08:05:45 UTC 2021] Installing cron job
no crontab for root
no crontab for root
[Fri Mar 19 08:05:45 UTC 2021] Good, bash is found, so change the shebang to use bash as preferred.
[Fri Mar 19 08:05:45 UTC 2021] OK
[Fri Mar 19 08:05:45 UTC 2021] Install success!
  • 生成证书
export Ali_Key="LTAI4FmiHYjQAr32GkmkjAfH" && export  Ali_Secret="bk7IXxKVHcoVsmf4mP8N85ANkNgsMi" ;acme.sh --issue --dns dns_ali -d "*.test.com"

结果有下面的

-----END CERTIFICATE-----
[Fri Mar 19 08:08:26 UTC 2021] Your cert is in  /root/.acme.sh/*.test.com/*. .com.cer 
[Fri Mar 19 08:08:26 UTC 2021] Your cert key is in  /root/.acme.sh/*.test.com/*.test.com.key 
[Fri Mar 19 08:08:26 UTC 2021] The intermediate CA cert is in  /root/.acme.sh/*.test.com/ca.cer 
[Fri Mar 19 08:08:26 UTC 2021] And the full chain certs is there:  /root/.acme.sh/*.test.com/fullchain.cer

注意 key 用 这个 /root/.acme.sh/*.test.com/*.test.com.key

CA 用 /root/.acme.sh/*.test.com/fullchain.cer 用第一个会有问题


安装harbor

  • github拿最新的tar包 解压到服务器

https://github.com/goharbor/harbor/releases

  • 安装docker compose

https://github.com/docker/compose/releases

去上面的地址下载一个docker-compose-Linux-x86_64

cp  docker-compose-Linux-x86_64  /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
  • 在线安装harbor

https://github.com/goharbor/harbor/releases

解压harbor-online-installer-v2.2.1.tgz

修改解压后的配置文件 harbor.yml.tmpl

修改hostname和证书位置 如果不需要https 可以不配

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: reg.mydomain.com
# https related config
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /your/certificate/path
  private_key: /your/private/key/path

修改密码的配置 默认是admin Harbor12345

# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345

把文件改名

mv harbor.yml.tmpl harbor.yml
  • 下面一键安装
root@test-harbor:/harbor# ./install.sh 
[Step 0]: checking if docker is installed ...
Note: docker version: 20.10.5
[Step 1]: checking docker-compose is installed ...
Note: docker-compose version: 1.28.5
[Step 2]: preparing environment ...
[Step 3]: preparing harbor configs ...
prepare base dir is set to /harbor
no config file: /harbor/harbor.yml
root@test-harbor:/harbor# cp harbor.yml.tmpl harbor.yml
root@test-harbor:/harbor# 
Digest: sha256:5721c120d6e44e1bdc3b9c0d56af57848430cabe5bbca415ff9f353c2f53024a
Status: Downloaded newer image for goharbor/nginx-photon:v2.1.4
Creating harbor-log ... done
Creating harbor-portal     ... done
Creating harbor-db     ... done
Creating registryctl   ... done
Creating redis         ... done
Creating registry      ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
✔ ----Harbor has been installed and started successfully.----
root@test-harbor:/harbor#

下面就可以登录harbor 新建项目了 比如新建config项目

harbor怎么安装_镜像仓库harbor的安装

其他操作

后台登录harbor镜像库

docker login -u admin -p Harbor12345 azure.test.com

push镜像

docker push azure.test.com/config/release:21.02.R1

可以在下面看到了

harbor怎么安装_镜像仓库harbor的安装

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 787013311@qq.com 举报,一经查实,本站将立刻删除。
(0)
上一篇 2022-09-17 14:27:41
下一篇 2022-09-17 14:30:54

相关推荐

发表回复

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