当前位置:网站首页>[deploy private warehouse based on harbor] 3 deploy harbor

[deploy private warehouse based on harbor] 3 deploy harbor

2022-06-11 06:58:00 Lone ranger_ Atao

Catalog

1 Prepositive action

1.1 install Docker Service and configure Alibaba cloud accelerator

1.1.1  Install the base package

1.1.2  To configure YUM Mirror warehouse

1.1.3 install Docker service

1.1.4 modify deamon.json To configure docker Alicloud image Accelerator

1.2  install docker-compose service

1.2.1 download

1.2.2 Add execute permission

1.2.3 View version

2 Deploy harbor

2.1 download

2.2 decompression

2.3 modify harbor.yml The configuration file

2.4 Start the service

3 Use harbor platform

3.1 Access address and account number

 3.2 Main panel


Last one , We have the machine ready , The next step is to operate the machine for a while .

The first thing to understand is ,harbor rely on docker and docker-compose, So we need to install these two services .

1 Prepositive action

1.1 install Docker Service and configure Alibaba cloud accelerator

1.1.1  Install the base package

yum -y install yum-utils device-mapper-persistent-data lvm2 

1.1.2  To configure YUM Mirror warehouse

yum-config-manager --add-repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

1.1.3 install Docker service

#  Inquire about docker edition 
yum list docker-ce --showduplicates|sort -r   
#  Install the specified version , Choose according to the production environment   I installed 18.09.8 edition 
yum -y install docker-ce-18.09.8  

1.1.4 modify deamon.json To configure docker Alicloud image Accelerator

I don't have Alibaba cloud image accelerator , So we can only use the netizens' for the time being :

Running the following command will automatically complete the configuration ( After you run the command, you will generate /etc/docker/daemon.json):

( The following command copies all , And paste it into the at one time terminal Inside , It will run automatically immediately , And finally stop on the last line of command , Enter again , It is all finished )

mkdir -p /etc/docker
cat << EOF > /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://k1ktap5m.mirror.aliyuncs.com"]
}
EOF
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload 
systemctl restart docker && systemctl enable docker

1.2  install docker-compose service

Official address :

Releases · docker/compose · GitHubicon-default.png?t=L892https://github.com/docker/compose/releases

1.2.1 download

Log in GitHub , Find the corresponding version to download ( The following command , The author installed 1.27.4 Version of docker-compose), And put the downloaded file in /usr/local/bin Under the table of contents

curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

1.2.2 Add execute permission

chmod +x /usr/local/bin/docker-compose

1.2.3 View version

docker-compose -version

2 Deploy harbor

2.1 download

Log in to the official address to download the corresponding version : https://github.com/goharbor/harbor/releasesicon-default.png?t=L892https://github.com/goharbor/harbor/releases

I download 2.1.1 The version of the command is as follows :

wget https://github.com/goharbor/harbor/releases/download/v2.1.1/harbor-offline-installer-v2.1.1.tgz

2.2 decompression

take harbor The service is pressurized to /home Under the table of contents , All the following operations take the decompressed directory as the current directory

tar xvf harbor-offline-installer-v2.1.1.tgz  -C /home/ && cd /home/harbor/

2.3 modify harbor.yml The configuration file

By default, only one is unzipped harbor.yml.tmpl, This is harbor.yml The template of

Based on this, create a harbor.yml The template of :

cp harbor.yml.tmpl harbor.yml

normal ,harbor.yml Is to provide https Access to the , So you can configure https, But I think localization is a mirror warehouse , There is no need to toss about so much , So I used http Access to , The following configuration is for http Configuration of the access mode of , If you want to https access , I will attach a reference link to it later .

[[email protected] harbor]# vi harbor.yml 
.....
.....
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.211.5  ########## Modify domain name , Because I don't set the domain name , So I set the local ip

http:           # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 80 

# https related config
# https:######### Comment out 
#   # https port for harbor, default is 443
#   port: 443  ######### Comment out 
#   # The path of cert and key files for nginx
#   certificate: /home/harbor/certs/harbor.crt       ######### Comment out 
#   private_key: /home/harbor/certs/harbor.key       ######### Comment out 
.....
.....
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: admin  ######### admin User login password 

# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: root       #########  Database password 

# The default data volume
data_volume: /data   ######### The directory is created by itself , Fill in... According to the actual situation , The author stays still 

2.4 Start the service

./install.sh 

Success log :

3 Use harbor platform

3.1 Access address and account number

The access address is harbor Of the deployed machine ip, The port number is us harbor.yml The port number specified in the . The default account is admin, The password is also in the configuration file , We designated .

Let's say mine is :

Url: http://192.168.211.5:80

account number :admin/admin

 3.2 Main panel

Log in :

  Click item library Go to project details :

The following push command , stay http It cannot be used directly under the agreement , Because the default is https Protocol to push , So just write 192.168.211.5 If the port is not written , Default access 443 port . The following command is only a reference , Next , I will share the right http The writing method of the push command of the protocol . 

 

Next , Push the mirror image to harbor

原网站

版权声明
本文为[Lone ranger_ Atao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020524444253.html