centos7 nginx搭建本地yum仓库

  • 安装依赖

    yum -y install yum-utils createrepo
    
  • 创建本地存储目录

    mkdir /data/mirror
    
  • 同步extras、updates、base、epel仓库到/data/mirror目录

    reposync -n --repoid=extras --repoid=updates --repoid=base --repoid=epel -p /data/mirror
    
  • 创建仓库索引

    createrepo -po /data/mirror/base/ /data/mirror/base/
    createrepo -po /data/mirror/extras/ /data/mirror/extras/
    createrepo -po /data/mirror/updates/ /data/mirror/updates/
    createrepo -po /data/mirror/epel/ /data/mirror/epel/
    
  • 更新仓库索引

    createrepo --update /data/mirror/base/
    createrepo --update /data/mirror/extras/
    createrepo --update /data/mirror/updates/
    createrepo --update /data/mirror/epel/
    
  • nginx配置

    server {
      listen 8090;
      server_name 192.168.200.102;
      location / {
        root /data/mirror/;
        autoindex on;
        index index.html index.htm;
      }
    }
    
    
  • 客户端local.repo

    [local_base]
    name=Centos7.9 local base
    baseurl=http://192.168.200.102:8090/base
    enable=1
    gpgcheck=0
    
    [local_extras]
    name=Centos7.9 local extras
    baseurl=http://192.168.200.102:8090/extras
    enable=1
    gpgcheck=0
    
    
    [local_updates]
    name=Centos7.9 local updates
    baseurl=http://192.168.200.102:8090/updates
    enable=1
    gpgcheck=0
    
    [local_epel]
    name=Centos7.9 local epel
    baseurl=http://192.168.200.102:8090/epel
    enable=1
    gpgcheck=0
    
    
    

你可能感兴趣的:(nginx,linux,nginx,运维,linux)