CentOS deployment Harbor

Environmental information###

  1. Operating system: CentOS Linux release 7.8.2003
  2. docker:19.03.11
  3. docker-compose:1.26.0
  4. harbor:1.10.3

Ready to work###

Assuming that your current CentOS system is a fresh installation, all the following operations are performed with the root account;

yum update -y
systemctl stop firewalld;systemctl disable firewalld;setenforce 0

Update yum source###

In order to install the application smoothly, it is recommended to update the yum source;

yum -y install wget
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache
yum -y update

Install docker

groupadd docker
gpasswd -a root docker
curl -sSL https://get.docker.com | sh
systemctl start docker && systemctl enable docker
[ root@centos7 ~]# docker version
Client: Docker Engine - Community
 Version:19.03.11
 API version:1.40
 Go version:        go1.13.10
 Git commit:        42e35e61f3
 Built:             Mon Jun  109:13:482020
 OS/Arch:           linux/amd64
 Experimental:false

Server: Docker Engine - Community
 Engine:
 Version:19.03.11
 API version:1.40(minimum version 1.12)
 Go version:       go1.13.10
 Git commit:       42e35e61f3
 Built:            Mon Jun  109:12:262020
 OS/Arch:          linux/amd64
 Experimental:false
 containerd:
 Version:1.2.13
 GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
 Version:1.0.0-rc10
 GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
 Version:0.18.0
 GitCommit:        fec3683

Install docker image accelerator###

It is recommended to install the docker image accelerator. There are many ways. If you have an Alibaba Cloud registered account, you can refer to the following operations:

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'{"registry-mirrors":["https://xxxxxxx.mirror.aliyuncs.com"]}
EOF
systemctl daemon-reload \
&& systemctl restart docker

Install docker-compose

yum -y install tree python-devel gcc epel-release python-pip

Note: If the above operation fails to install, please try again separately;

pip install --upgrade pip
pip install docker-compose
[ root@centos7 ~]# docker-compose version
docker-compose version 1.26.0, build unknown
docker-py version:4.2.1
CPython version:2.7.5
OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017

Install harbor

wget https://github.com/goharbor/harbor/releases/download/v1.10.3/harbor-online-installer-v1.10.3.tgz \
&& tar -zxvf harbor-online-installer-v1.10.3.tgz
[ root@centos7 ~]# tree harbor
harbor
├── common.sh
├── harbor.yml
├── install.sh
├── LICENSE
└── prepare
[ root@centos7 harbor]# clear
[ root@centos7 harbor]# ./prepare 
prepare base dir is set to /root/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
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
......
Digest: sha256:7903f39d47db4182f424539ec36294c407e7ac1e2e39fa095609a296e180b9e0
Status: Downloaded newer image for goharbor/harbor-registryctl:v1.10.3
Creating harbor-log ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating redis         ... done
Creating harbor-portal ... done
Creating registryctl   ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
✔ ----Harbor has been installed and started successfully.----

At this point, the harbor is successfully deployed, and then verify whether it is available;

verification###

{" insecure-registries":["192.168.133.174"]}
systemctl daemon-reload  && systemctl restart docker

Remind again: This modification is the configuration of the machine remotely connected to the Harbor service, not the configuration of the Harbor server;

Verify push mirror###

[ root@centos7 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tomcat              latest              2eb5a120304e        3 days ago          647MB
docker tag 2eb5a120304e 192.168.133.174/library/tomcat:latest
[ root@centos7 ~]# docker images
REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
192.168.133.174 /library/tomcat   latest              2eb5a120304e        3 days ago          647MB
tomcat                           latest              2eb5a120304e        3 days ago          647MB
docker login 192.168.133.174-u admin -p Harbor12345
docker push 192.168.133.174/library/tomcat:latest

So far, the deployment and verification of harbor-1.10 is complete. If you are also deploying harbor, I hope this article can give you some reference;

Recommended Posts

CentOS deployment Harbor
CentOS server deployment (YUM)
CentOS7.6 server deployment VNC
[CentOS environment deployment] Java7/Java8 deployment under CentOS
CentOS 8 (2)
Centos7.4 deployment configuration Elasticsearch5.6 cluster
Deployment of graphite on centos7
CentOS deploys Harbor mirror warehouse
CentOS 8 (1)
Centos7.2 deployment vnc service record
Ceph rapid deployment (Centos7 + Jewel)
Centos6.5 installation and deployment of KVM
RabbitMQ cluster deployment record under Centos6.9
Elasticsearch cluster deployment record under CentOS7
CentOS deployment method of flask project
CentOs7 installation and deployment Zabbix3.4 original
Erlang 20.2 installation and deployment under CentOS 7
k8s practice (1): Centos 7.6 deployment k8s (v1.14.2) cluster
PPTP environment deployment record under Centos
Concise summary of Ceph deployment on Centos7
centos7 python3.7+vi
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Centos-6.5 installation and deployment of LNMP environment
Centos7 installation and deployment of gitlab server
CentOS + Jenkins
Zabbix installation and deployment and localization under CentOS
CentOS 7 Apache Multi-port Deployment Web Apps Guide
Jenkins installation and deployment tutorial under CentOS 7
Python and scrapy deployment in centos environment
1.5 Install Centos7
Complete deployment record for LDAP under Centos7.2
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos 7.5 python3.6
Centos7 installation and deployment of Airflow detailed
Some Centos Python production environment deployment commands
K8S: (1) A preliminary study on CentOS stand-alone deployment
MySQL 8.0 installation and deployment under CentOS, super detailed!
Distributed deployment of Apollo configuration center under CentOS8
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8