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
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
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
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
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
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
Open the configuration file harbor.yml, and then start to modify the configuration;
hostname configures the local domain name, if there is no domain name, configure it as IP:
If you need to modify the http port, modify the position of the red box in the figure below:
If https is not required, be sure to comment out the relevant configuration (otherwise it will cause failure to start), as shown in the red box in the following figure:
If you want to modify the https setting, modify the position of the red box in the following figure:
If you want to modify the initial password of the administrator account, modify the position of the red box in the following figure:
Execute ./prepare in the harbor directory, the output of the control bar is as follows:
[ 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;
{" 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;
[ 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