系统版本:centos7.6
Harbor版本:v1.7.4-ce6a6237
安装方式:docker-compose
端口:5080
访问方式:IP:5080
默认密码:Harbor12345
#!/bin/bashcat > /etc/yum.repos.d/gitlab-ce.repo << 'EOF'[gitlab-ce]name=Gitlab CE Repositorybaseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/gpgcheck=0enabled=1EOFwget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.reposleep 5wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo#pypi 镜像#临时使用yum install python-pip -ypip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-packagepip install pip -Upip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simplepip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U #docker-cewget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.reposudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.reposed 's/enabled=0/enabled=1/g' *.repo -i#配置yum源sed '/^GSSAPI/s/yes/no/g; /UseDNS/d; /Protocol/aUseDNS no' /etc/ssh/sshd_config -ised 's/TimeoutSec=0/TimeoutSec=200/g' /usr/lib/systemd/system/rc-local.service -ised -i 's#=enforcing#=disabled#g' /etc/selinux/configsetenforce 0getenforcesystemctl stop firewalld.servicesystemctl disable firewalld.servicerpm -aq | grep net-tools || yum install net-tools -y > /dev/null########################################################################################################################################################################################################################################检测本机master IP地址net=$(ls -l /etc/sysconfig/network-scripts/ifcfg-*|awk -F "-" '{print $NF}'|grep -v lo)IP=$(for var in $net;do ifconfig $var 2>/dev/null;done|grep inet|grep -v inet6|awk '{print $2}')##############################################################################yum install -y yum-utils device-mapper-persistent-data lvm2 #安装最新版本docker-ce yum install docker-ce -y systemctl start dockerpip install docker-compose#下载离线安装包https://github.com/goharbor/harbor/releases## Harbor的启动和停止# 启动Harbor# # docker-compose start# 停止Harbor# # docker-comose stop# 停止并且删除容器# docker-compose down -v# 重启Harbor# # docker-compose restartwget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.4.tgztar -xzvf harbor-offline-installer-v1.7.4.tgz -C /usr/local/cd /usr/local/harbor;sed "s/reg.mydomain.com/$IP/g" -i harbor.cfg sed "s/80:80/5080:80/g" docker-compose.yml -i sh install.shecho "http://$IP:5080"
安装过程截图
![48bd46f4dfa9a148e78c4a8e364db924.png](https://i-blog.csdnimg.cn/blog_migrate/4d06666d5849cf6ecc653a17046cc65b.jpeg)
![1665ef07c813dffdc87f5f61a8d6e35c.png](https://i-blog.csdnimg.cn/blog_migrate/1205ef775ccdae889a55116e5c9cc6a8.jpeg)
![56067ed26038f66f945c2e5183c52937.png](https://i-blog.csdnimg.cn/blog_migrate/e4d312c8f0103c5137624d09b04fd884.jpeg)
![ae6ae04a2ea9d45ef8cd4283b07593f5.png](https://i-blog.csdnimg.cn/blog_migrate/4368498b413485f7caa1a50bedbdf308.jpeg)
![65543742225dfc00702fff31771ecd96.png](https://i-blog.csdnimg.cn/blog_migrate/8011a040bac291028ce8f71a0e957d35.jpeg)
![094a04da1501a8d94435d55c3ae5e6f5.png](https://i-blog.csdnimg.cn/blog_migrate/1e8be61da71db8c58f8c7a832e7d8bbd.jpeg)