AnolisOS7.9(CentOS7)安装Harbor
本文中所有的配置文件、包可以从下面链接下载:
链接:https://pan.baidu.com/s/1zM_uM_FLU6wV6EyRszv3_w
提取码:7gfr
1. 确保已安装好Docker
2. 下载Harbor安装包
地址:https://github.com/goharbor/harbor/releases
3. 上传后解压
mkdir -p /data/harbor cd /data/harbor tar zxvf harbor-offline-installer-v2.9.4.tgz
4. 拷贝并编辑yml文件
cd /data/harbor/harbor cp harbor.yml.tmpl harbor.yml
5. 修改hostname、port、注释https相关参数
vi /data/harbor/harbor/harbor.yml
6. 安装
cd /data/harbor/harbor ./install.sh
7. 设置开机启动
vi /usr/lib/systemd/system/harbor.service
添加如下内容
[Unit] Description=Harbor After=docker.service systemd-networkd.service systemd-resolved.service Requires=docker.service [Service] Type=simple Restart=on-failure RestartSec=5 ExecStart=/usr/libexec/docker/cli-plugins/docker-compose -f /data/harbor/harbor/docker-compose.yml up ExecStop=/usr/libexec/docker/cli-plugins/docker-compose -f /data/harbor/harbor/docker-compose.yml down [Install] WantedBy=multi-user.target
8. ExecStart=/usr/local/bin/docker-compose 的路径通过下面的命令获取
sudo find / -name docker-compose
8. 使配置生效
systemctl daemon-reload
9. 启动、重启、停止、状态、开机启动
systemctl start harbor
systemctl restart harbor
systemctl stop harbor
systemctl status harbor
systemctl enable harbor
10. 如果修改了harbor.yml中的配置,需要重新生成程序文件
cd /data/harbor/harbor ./prepare docker-compose down -v docker-compose up -d # 然后重启 system restart harbor # 如果提示bash: docker-compose: 未找到命令... export PATH=$PATH:/usr/libexec/docker/cli-plugins # 刷新 source ~/.bashrc
11. 默认用户名:admin,默认密码:Harbor12345