harbor离线安装

环境:centos7.6

1、安装docker

详情见:https://www.cnblogs.com/wukc/p/13265528.html

2、配置时区 

timedatectl set-timezone Asia/Shanghai

3、修改主机名称

hostnamectl set-hostname harbor

4、创建磁盘并挂载

pvcreate /dev/vdb
vgcreate data /dev/vdb
lvcreate -l 100%VG -n lv_harbor data 
mkdir /harbor
mkfs.xfs /dev/mapper/data-lv_harbor
more /etc/fstab                       #配置开机挂载磁盘
UUID=f81a1f4f-5608-46bc-b4ef-6d0f675eeacd  /harbor   xfs  defaults        0 0
mount -a
[root@harbor-20 harbor]#  df /harbor
Filesystem                 1K-blocks    Used Available Use% Mounted on
/dev/mapper/data-lv_harbor 209608708 1415772 208192936   1% /harbor

5、harbor安装

wget https://github.com/goharbor/harbor/releases/download/v1.10.1/harbor-offline-installer-v1.10.1.tgz #下载文件

解压tar -zxvf /harbor/harbor-offline-installer-v1.10.1.tgz
加载镜像 cd harbor/&& docker load -i harbor.v1.10.1.tar.gz
将docker-compose 放到/usr/local/bin 目录下 并赋权
mv docker-compose  /usr/local/bin  && chmod u+x /usr/local/bin/docker-compose
进入解压目录,配置harbor.yml(修改ip、web密码、数据目录、注释https)
      hostname: 172.20.210.20 
       # https related config
       #https:
       # https port for harbor, default is 443
       #  port: 443
       # The path of cert and key files for nginx
       #  certificate: /your/certificate/path
       #  private_key: /your/private/key/path
      harbor_admin_password: Harbor12345
      data_volume: /harbor/data
新建数据目录 mkdir /harbor/data
环境预配          ./prepare
habbor安装        ./install.sh
       
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating registry      ... done
Creating redis         ... done
Creating harbor-db     ... done
Creating registryctl   ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done----Harbor has been installed and started successfully.----
View Code

6、登录验证

http://ip    账号密码为上面配置文件中:admin:Harbor12345

7、配置docker使用harbor仓库

修改配置文件
vi /etc/docker/daemon.json 
{
 "insecure-registries":["172.20.210.20"]  #添加harbor仓库地址
}
systemctl restart docker
docker login:172.21.210.20

 8、harbor启动和重启

cd /harbor/harbor
docker-compose up -d     #后台启动
docker-compose restart   #重启

 

posted @ 2020-07-09 14:35  苍茫宇宙  阅读(2835)  评论(0编辑  收藏  举报