参考:How to Setup Local HTTP Yum Repository on CentOS 7

实验环境

CentOS7 1804

步骤一:安装Nginx Web Server

最小化安装后替换Yum源为163源:http://mirrors.163.com/.help/centos.html

yum clean all
yum makecache

安装epel和nginx

yum install epel-release
yum install nginx

启用Nginx并设置开机自动启动

systemctl start nginx
systemctl enable nginx
systemctl status nginx

设置防火墙,允许http,https

firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --reload

步骤二:创建本地Yum仓库

安装必要包,用于创建、配置、管理本地仓库

yum install createrepo  yum-utils

创建存储rpm包的目录

mkdir -p /var/www/html/repos/{base,centosplus,extras,updates}

同部远程yum仓库的包到本地yum仓库

reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/repos/

为本地存放rpm包的目录创建repodata

createrepo -g comps.xml /var/www/html/repos/base/
createrepo comps.xml /var/www/html/repos/centosplus/
createrepo comps.xml /var/www/html/repos/extras/
createrepo comps.xml /var/www/html/repos/updates/

修改/etc/nginx/nginx.conf文件server段

server {
listen default_server;
listen [::]: default_server;
server_name _;
root /usr/share/nginx/html; # Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf; location / {
root /var/www/html/repos;
index index.php index.html index.htm;
autoindex on; #enable listing of directory index
} error_page 404 /404.html;
location = /40x.html {
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

保存并重启Nginx

步骤三:检查本地Yum仓库

但是进入到具体目录看不到rpm包

基于CentOS构建企业镜像站的更多相关文章

  1. DevOps实践之一:基于Docker构建企业Jenkins CI平台

    基于Docker构建企业Jenkins CI平台 一.什么是CI 持续集成(Continuous integration)是一种软件开发实践,每次集成都通过自动化的构建(包括编译,发布,自动化测试)来 ...

  2. 微服务架构 - 基于Harbor构建本地镜像仓库

    之前写过<搭建docker本地镜像仓库并提供权限校验及UI界面>文章,然后有同仁评论道这样做太复杂了,如果Harbor来搭建会更简单同时功能也更强大.于是抽时间研究了基于Harbor构建本 ...

  3. (转)基于OpenStack构建企业私有云(1)实验环境准备

    原文:https://www.unixhot.com/article/407 https://www.cnblogs.com/kevingrace/p/5707003.html-----完整部署Cen ...

  4. 基于url-to-pdf-api构建docker镜像,制作一个网页另存服务

    基于url-to-pdf-api构建docker镜像,制作一个网页另存服务 业务背景: 需要根据一个url路径打印这个网页的内容 解决方案: 1.使用wkhtml2pdf 2.使用puppeteer ...

  5. 基于Kubernetes构建企业Jenkins master/slave CI/CD平台

    搭建平台目的: k8s中搭建jenkins master/slave架构,解决单jenkins执行效率低,资源不足等问题(jenkins master 调度任务到 slave上,并发执行任务,提升任务 ...

  6. 基于Kubernetes构建企业容器云

    前言 团队成员有DBA.运维.Python开发,由于需要跨部门向公司私有云团队申请虚拟机, 此时我在思考能否在现有已申请的虚拟机之上,再进行更加细粒度的资源隔离和划分,让本团队的成员使用, 也就是在私 ...

  7. CentOS更换aliyun镜像站

    目录 1. 官方地址 2. 社区文档 3. 镜像更换 3.1 配置方法: 3.1.1. 备份原配置文件 3.1.2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ ...

  8. 基于centos 创建stress镜像——源码安装stress

    上一篇文章进行了yum安装stress,这次对stress进行源码编译安装,并且生成新的镜像 创建Dockerfile目录 [vagrant@localhost ~]$ mkdir -p /tmp/s ...

  9. 基于 Docker 构建企业 Jenkins CI平台

    持续集成(Continuous Integration,CI):代码合并.构建.部署.测试都在一起,不断地执行这个过程,并对结果反馈. 持续部署(Continuous Deployment,CD):部 ...

随机推荐

  1. Text Prompted Remote Speaker Authentication : Joint Speech and Speaker Recognition/Verification System :: Major Project ::: Introduction

    转载自:http://ganeshtiwaridotcomdotnp.blogspot.com/2010/12/text-prompted-remote-speaker.html Biometrics ...

  2. 【PromQL】prometheus查询语言

    常用查询: https://songjiayang.gitbooks.io/prometheus/content/exporter/nodeexporter_query.html group by 操 ...

  3. PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'exchange' in vhost '/': received 'direct

    最近在搞rabbitmq,把解决问题方法记下 问题1:PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'exchange' in ...

  4. CountDownLatch和CyclicBarrier使用上的区别

    一.CountDownLatchDemo package com.duchong.concurrent; import java.util.Map; import java.util.concurre ...

  5. RocketMQ控制台命令

    本文未完成,有空再补充,不小心发布了,抱歉 Rocket版本:4.3.0 这几天在整RocketMQ,可谓是困难重重,其中关于控制台的命令,网上的都是一半一半的, 所以我打算直接用整一个完整的官方的命 ...

  6. Traking-Learning-Detection TLD经典论文部分翻译

    摘要 本文研究视频流中未知目标的长期跟踪问题.在第一帧,通过选定位置和大小定义跟踪目标.在接下来的每一帧中,跟踪任务是确定目标的位置和大小或者说明目标不存在.我们提出了一种新颖的跟踪框架(TLD),明 ...

  7. Span复习

    Span复习 using System; namespace Span复习 { class Program { static void Main(string[] args) { //Console. ...

  8. Git时间 —— 初始版本控制工具

    <第一行代码>读书手札 可能你早就听闻git,奈何看不懂命令吓退了. 今天逆流而上. (1.)安装Git 登录官网,下载最新版,一路下一步.就完成安装了. (2.)创建本地代码仓库 首先配 ...

  9. django初识1

    django django初识 django的本质就是基于socket通信 一.127.0.0.1 本地回环地址 后面:8001是端口号 /ppt是根目录下的ppt子网页 二./当前网站的客户端(根目 ...

  10. js 中加减乘除 比较精确的算法,js本身有些运算会出错,这里给出较精确的算法

    问题这样的: 37.5*5.5=206.08  (JS算出来是这样的一个结果,我四舍五入取两位小数) 我先怀疑是四舍五入的问题,就直接用JS算了一个结果为:206.08499999999998 怎么会 ...