目录
1.下载安装包和依赖
harbor依赖docker环境,所以安装Harbor之前必须保证系统已安装docker和docker-compose。
docker安装参见
docker-compose的github下载地址docker-compose下载,我这里直接wget下载
wget https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64
下载后重命名为docker-compose放到/usr/bin/目录下
mv docker-compose-Linux-x86_64 /usr/bin/docker-compose
修改权限
chmod +x /usr/bin/docker-compose
查看版本
# docker-compose -v
docker-compose version 1.25.0, build 0a186604
去官网下载安装包后上传到服务器,不要用服务器在线下载,比较慢 harbor
我这里下的是harbor-offline-installer-v2.7.1.tgz
2.修改配置并安装
#解压文档
tar -zxvf harbor-offline-installer-v2.7.1.tgz
#进入文件夹
cd harbor
修改harbor.yml.tmpl 文件
http和https选一个就行,注释掉另一个,hostname用真实可用ip,因为harbor要被其他机器访问
默认端口为80,我这里修改为8020了,默认密码是Harbor12345,我这里修改成自己的密码
# 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: 10.9.10.72
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 8020
# 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
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: aa123456
复制一份harbor.yml.tmpl为harbor.yml
cp harbor.yml.tmpl harbor.yml
执行安装
# 预处理命令,会拉取一些镜像,创建一些文件夹,初始化一些文件
./prepare
# 执行安装
./install.sh
3.测试
Creating harbor-log ... done
Creating harbor-portal ... done
Creating redis ... done
Creating registry ... done
Creating registryctl ... done
Creating harbor-db ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating nginx ... done
✔ ----Harbor has been installed and started successfully.----
安装成功后,会显示如上内容,根据之前配置的ip:port查看harbor,正常显示登录页代表安装成功