Harbor企业级私有仓库搭建
安装docker-compose
首先需要先安装docker-compose才能进行安装Harbor。
进入官网
根据官网的提示安装docker-compose:
- 在linux系统下下载;
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
由于是国外的网站可能下载较慢,可以多试几次;当然你也可以使用国内的源地址进行下载
curl -L https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
- 将可执行权限应用于二进制文件;
sudo chmod +x /usr/local/bin/docker-compose
- 验证是否安装成功
docker-compose -version
这样docker-compose就安装完成了,此时准备工作完成。
安装Harbor
下载harbor的离线安装包
此处我是用的是 harbor-offline-installer-v1.9.4.tgz,可以通过我上传的资源进行下载地址harbor离线宝
进入系统进行安装
将下载的离线包传到linux系统上
## 1、解压缩
[root@master ~]# tar -zxvf harbor-offline-installer-v1.9.4.tgz
harbor/harbor.v1.9.4.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/harbor.yml
[root@master ~]# ls
anaconda-ks.cfg conf data harbor harbor-offline-installer-v1.9.4.tgz logs nginx-1.19.6 nginx-1.19.6.tar.gz store
## 2、进入解压后的路径
[root@master ~]# cd harbor
[root@master harbor]# ls
harbor.v1.9.4.tar.gz harbor.yml install.sh LICENSE prepare
## 3、执行准备安装文件
[root@master harbor]# ./prepare
prepare base dir is set to /root/harbor
Unable to find image 'goharbor/prepare:v1.9.4' locally
v1.9.4: Pulling from goharbor/prepare
59bb73b1db41: Pull complete
151a8120c357: Pull complete
bdb3b55ae888: Pull complete
bc627acc6004: Pull complete
b9e028a223e6: Pull complete
0b1166b529f5: Pull complete
5255c5c54d23: Pull complete
Digest: sha256:3b0e3b40be3056aa2eab2f02393065a615e442c7e6f572def2f1f991257c8d5d
Status: Downloaded newer image for goharbor/prepare:v1.9.4
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
## 4、执行安装脚本
[root@master harbor]# ./install.sh
➜ Please set hostname and other necessary attributes in harbor.yml first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.yml bacause notary must run under https.
Please set --with-clair if needs enable Clair in Harbor
Please set --with-chartmuseum if needs enable Chartmuseum in Harbor
## 5、修改配置 此处比较重要
[root@master harbor]# vi harbor.yml
## 修改hostname
# Configuration file of Harbor
# 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: 192.168.135.110
...
...
...
## 6、执行安装脚本
[root@master harbor]# ./install.sh
通过浏览器访问登录系统
http://192.168.135.110/harbor 这里注意修改为你自己的ip地址
用户名: admin
密码: Harbor12345
密码是在harbor.yml 中配置的。