Harbor和YUM部署for CentOS 7

Harbor部署for CentOS 7

下载

  wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.1.tgz

tar xvf harbor-offline-installer-<version>.tgz

Configure harbor.cfg

  hostname = 192.192.49.87
harbor_admin_password = Harbor12345

Install

  sudo ./install.sh

END

yum部署for CentOS 7

建立文件夹

  sudo mkdir -p /var/yum_data/centos/7/{os,updates,extras,other}/x86_64
sudo yum -y install createrepo

#同步某个repo到指定目录,不建议用
sudo reposync -r docker-ce-stable -p /var/yum_data/centos/7/other/
sudo reposync -r base -p /var/yum_data/centos/7/os/

#下载某个软件到指定目录,也不建议用
sudo yum install --downloadonly --downloaddir=\
/var/yum_data/centos/7/other/x86_64/docker-ce-stable \
docker-ce

创建repo

  #下载rpm到目标目录
sudo yum install --downloadonly --downloaddir=/var/yum_data/centos/7/other/x86_64/nginx/ nginx

sudo yumdownloader --resolve --destdir=/var/yum_data/centos/7/other/x86_64/docker-ce-stable/ docker-ce-18.09.1-3.el7

sudo yumdownloader --resolve --destdir=/var/yum_data/centos/7/other/x86_64/mariadb/ mariadb mariadb-server

sudo createrepo /var/yum_data/centos/7/other/x86_64
sudo createrepo --update /var/yum_data/centos/7/other/x86_64

nginx映射

  #harbor的yml 的proxy下添加
  volumes:
     - ./common/config/nginx:/etc/nginx:z
     - /var/yum_data:/var/yum_data:z

Harbor的nginx配置添加如下

/home/centos/harbor/common/config/nginx

      location /centos/ {
    root /var/yum_data;
    autoindex_exact_size off;
  }

客户端repo设置

下载添加repo

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

sudo yum-config-manager --add-repo \
http://192.192.49.87/centos/7/other/cnicg.repo

sudo yum clean all
sudo yum makecache
sudo yum --disablerepo=base,updates,extras install -y mariadb mariadb-server

cnicg.repo

  # cnicg repo
# copy this repo to destination-host,'/etc/yum.repos.d/'
# and run 'sudo yum clean all && sudo yum makecache'

[cnicg]
name=CentOS-$releasever - cnicg
baseurl=http://192.192.49.87/centos/$releasever/other/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

END

posted @ 2019-01-25 16:40  Fatt  阅读(370)  评论(0编辑  收藏  举报