基于CentOS构建企业镜像站
参考: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构建企业镜像站的更多相关文章
- DevOps实践之一:基于Docker构建企业Jenkins CI平台
基于Docker构建企业Jenkins CI平台 一.什么是CI 持续集成(Continuous integration)是一种软件开发实践,每次集成都通过自动化的构建(包括编译,发布,自动化测试)来 ...
- 微服务架构 - 基于Harbor构建本地镜像仓库
之前写过<搭建docker本地镜像仓库并提供权限校验及UI界面>文章,然后有同仁评论道这样做太复杂了,如果Harbor来搭建会更简单同时功能也更强大.于是抽时间研究了基于Harbor构建本 ...
- (转)基于OpenStack构建企业私有云(1)实验环境准备
原文:https://www.unixhot.com/article/407 https://www.cnblogs.com/kevingrace/p/5707003.html-----完整部署Cen ...
- 基于url-to-pdf-api构建docker镜像,制作一个网页另存服务
基于url-to-pdf-api构建docker镜像,制作一个网页另存服务 业务背景: 需要根据一个url路径打印这个网页的内容 解决方案: 1.使用wkhtml2pdf 2.使用puppeteer ...
- 基于Kubernetes构建企业Jenkins master/slave CI/CD平台
搭建平台目的: k8s中搭建jenkins master/slave架构,解决单jenkins执行效率低,资源不足等问题(jenkins master 调度任务到 slave上,并发执行任务,提升任务 ...
- 基于Kubernetes构建企业容器云
前言 团队成员有DBA.运维.Python开发,由于需要跨部门向公司私有云团队申请虚拟机, 此时我在思考能否在现有已申请的虚拟机之上,再进行更加细粒度的资源隔离和划分,让本团队的成员使用, 也就是在私 ...
- CentOS更换aliyun镜像站
目录 1. 官方地址 2. 社区文档 3. 镜像更换 3.1 配置方法: 3.1.1. 备份原配置文件 3.1.2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ ...
- 基于centos 创建stress镜像——源码安装stress
上一篇文章进行了yum安装stress,这次对stress进行源码编译安装,并且生成新的镜像 创建Dockerfile目录 [vagrant@localhost ~]$ mkdir -p /tmp/s ...
- 基于 Docker 构建企业 Jenkins CI平台
持续集成(Continuous Integration,CI):代码合并.构建.部署.测试都在一起,不断地执行这个过程,并对结果反馈. 持续部署(Continuous Deployment,CD):部 ...
随机推荐
- Element 'repository' cannot have character [children], because the type's content type is element-only.
出错现象 由于代码是网络上拷贝来的,可能存在特殊字符,在进行maven打包的时候报错 [ERROR] Malformed POM F:\ai开放平台\SRC\web知识产权申请\pom.xml: ex ...
- Delphi XE中使用dbExpress连接MySQL数据库疑难问题解决
Delphi IDE中包含一个Data Explorer的组件,如下图所示: 该组件基于dbExpress(包含TSQLConnection.TSQLDataSet.TSQLQuery.TSQLSto ...
- Codeforces Round #556 (Div. 2) D. Three Religions 题解 动态规划
题目链接:http://codeforces.com/contest/1150/problem/D 题目大意: 你有一个参考串 s 和三个装载字符串的容器 vec[0..2] ,然后还有 q 次操作, ...
- 【linux学习笔记五】帮助命令
man //查看ls作用 man ls man -f命令 相当于 whatis命令 --help ls --help help help shell help cd info详细命令帮助
- 2019年Java中高级面试题总结(8)
116.什么时候使用访问者模式? 访问者模式用于解决在类的继承层次上增加操作,但是不直接与之关联.这种模式采用双派发的形式来增加中间层. 117.什么时候使用组合模式? 组合模式使用树结构来展示部分与 ...
- php is_writeable函数bug问题
其中bug存在两个方面,1.在windowns中,当文件只有只读属性时,is_writeable()函数才返回false,当返回true时,该文件不一定是可写的.如果是目录,在目录中新建文件并通过打开 ...
- ES-IK分词器
一.安装 https://www.cnblogs.com/wudequn/p/11001382.html https://github.com/medcl/elasticsearch-analysis ...
- todo---git 生成密钥 原理分析
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRJkDZ2z7syFC2QDCaORKF41ecwbL/kyFwkycOVE3MavTRBliAhoAhOaZQTr4j ...
- poj 3061 题解(尺取法|二分
题意 $ T $ 组数据,每组数据给一个长度 $ N $ 的序列,要求一段连续的子序列的和大于 $ S $,问子序列最小长度为多少. 输入样例 2 10 15 5 1 3 5 10 7 4 9 2 8 ...
- QueryList::Query() The received content is empty!的经准灵活解决办法
QueryList::Query() The received content is empty! 最近因为项目问题出现The received content is empty!,我也有过在网上寻找 ...