目的
本地缓存 epel 库
利用本地 http 对 eple rpm 进行本地共享
epel rpm 安装
yum install -y epel-release
epel 下载
建议使用 rsync 进行 epel 下载
eple 常见有两个库 ( modular-8 与 8 )
参考下面获取 mirrorlist 方法
curl --insecure "https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=x86_64&infra=stock&content=centos"
curl --insecure "https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos"
只举例上面其中一个 modular 8 , 通过 curl 获得下面信息
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/" type="dynamic" pubdate="Thu, 14 Jan 2021 02:40:57 GMT" generator="mirrormanager" xmlns:mm0="http://fedorahosted.org/mirrormanager">
<files>
<file name="repomd.xml">
<mm0:timestamp>1609464721</mm0:timestamp>
<size>3102</size>
<verification>
<hash type="md5">f14e20b89fd948bad1c86823291d68b8</hash>
<hash type="sha1">ed6e1fb06988e55a005f5efb33b15333e5dc37ff</hash>
<hash type="sha256">a29f3dfe36d3413ded9c1e625432167793d8ec1a818676cc5eeb7b095b5f5d24</hash>
<hash type="sha512">af6e48f0df298502453626708046df7def214e1f81cfcfef92359b7a044e1fcd739d9d8ae4d8d099a67bd645194a1983cb8d7b1e1c5ee4d0aa63be97dafa2ce3</hash>
</verification>
<resources maxconnections="1">
<url protocol="https" type="https" location="CN" preference="100">https://mirrors.tuna.tsinghua.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="CN" preference="100">http://mirrors.tuna.tsinghua.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="CN" preference="100">rsync://mirrors.tuna.tsinghua.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="CN" preference="99">https://mirrors.ustc.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="CN" preference="99">http://mirrors.ustc.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="CN" preference="99">rsync://rsync.mirrors.ustc.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="CN" preference="98">http://mirrors.bfsu.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="CN" preference="98">rsync://mirrors.bfsu.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="CN" preference="97">http://mirrors.neusoft.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="CN" preference="97">https://mirrors.neusoft.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="CN" preference="97">rsync://mirrors.neusoft.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="CN" preference="96">https://mirror.sjtu.edu.cn/fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="CN" preference="95">http://mirror.lzu.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="CN" preference="95">https://mirror.lzu.edu.cn/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="JP" preference="94">http://ftp.iij.ad.jp/pub/linux/Fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="JP" preference="94">rsync://ftp.iij.ad.jp/pub/linux/Fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="JP" preference="93">https://nrt.edge.kernel.org/fedora-buffet/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="JP" preference="92">http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="JP" preference="92">https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="JP" preference="92">rsync://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="JP" preference="91">http://ftp.riken.jp/Linux/fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="JP" preference="91">rsync://ftp.riken.jp/fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="SG" preference="90">rsync://download.nus.edu.sg/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="SG" preference="90">https://download.nus.edu.sg/mirror/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="SG" preference="90">http://download.nus.edu.sg/mirror/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="ID" preference="89">http://mirror.poliwangi.ac.id/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="ID" preference="88">rsync://epel.mirror.angkasa.id/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="ID" preference="88">http://epel.mirror.angkasa.id/pub/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="IQ" preference="87">http://mirror.earthlink.iq/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="JP" preference="86">http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="JP" preference="86">rsync://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="HK" preference="85">http://epel.01link.hk/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="HK" preference="85">https://epel.01link.hk/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="TH" preference="84">http://mirrors.bestthaihost.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="TH" preference="84">rsync://mirrors.bestthaihost.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="TH" preference="83">http://mirror2.totbb.net/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="TH" preference="83">rsync://mirror2.totbb.net/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="AZ" preference="82">http://mirror.yer.az/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="AZ" preference="82">https://mirror.yer.az/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="BD" preference="81">http://mirror.xeonbd.com/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="KZ" preference="80">rsync://mirror.ps.kz/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="KZ" preference="80">http://mirror.ps.kz/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="KZ" preference="80">https://mirror.ps.kz/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="MY" preference="79">http://my.mirrors.thegigabit.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="KZ" preference="78">https://mirror.hoster.kz/fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="KZ" preference="78">http://mirror.hoster.kz/fedora/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="KZ" preference="78">rsync://mirror.hoster.kz/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="MY" preference="77">http://fedora.ipserverone.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="MY" preference="77">https://fedora.ipserverone.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="TW" preference="76">http://fedora.cs.nctu.edu.tw/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="TW" preference="76">rsync://fedora.cs.nctu.edu.tw/fedora-epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="HK" preference="75">http://hk.mirrors.thegigabit.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="HK" preference="74">https://hkg.mirror.rackspace.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="HK" preference="74">rsync://hkg.mirror.rackspace.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="HK" preference="74">http://hkg.mirror.rackspace.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="TH" preference="73">https://mirrors.thzhost.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="rsync" type="rsync" location="TH" preference="73">rsync://mirrors.thzhost.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="TH" preference="73">http://mirrors.thzhost.com/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="http" type="http" location="ID" preference="72">http://mirror.telkomuniversity.ac.id/epel/8/Modular/x86_64/repodata/repomd.xml</url>
<url protocol="https" type="https" location="ID" preference="72">https://mirror.telkomuniversity.ac.id/epel/8/Modular/x86_64/repodata/repomd.xml</url>
</resources>
</file>
</files>
</metalink>
其实这里已经提供了允许你使用 rsync 获取 epel8 软件的服务器地址, 自己选择一个网速好的进行数据同步
rsync 同步
rsync -av rsync://mirrors.tuna.tsinghua.edu.cn/epel/8/Everything/x86_64/* .
rsync -av rsync://mirrors.tuna.tsinghua.edu.cn/epel/8/Modular/x86_64/* .
私有 httpd
参考下面 epel repo
[epel-modular]
name=Extra Packages for Enterprise Linux Modular $releasever - $basearch
#baseurl=https://download.fedoraproject.org/pub/epel/$releasever/Modular/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
准备
从上面 repo 知道我们需要准备两个条件
1 dns 强制接管, 即本地需要有 DNS 服务器, bind 或 pdns , 并创建 fedoraproject.org 主域
2 http 服务器需要支持 https 访问 并支持 vhost (mirros.fedoraproject.org 的访问
DNS 及 http 服务器搭建(略)
metalink 创建
repo 中有这个 metalink 配置
https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
意味着可以通过 https://mirrors.fedoraproject.org url 访问到一个 metalink 的文件
这个文件访问时候带了参数repo=epel-modular-$releasever
arch=$basearch
infra=$infra
content=$contentdir
使用个简答的 php 回应就可以, 目的就是为了返回一个完整的 metalink 文件 (参考)之前 epel 下载演示
exaple:
当我这里的服务器访问了下面 url 之后, 可以返回我自定义的一个 metalink data info
url
https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
metalink data
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/" type="dynamic" pubdate="Thu, 14 Jan 2021 02:40:57 GMT" generator="mirrormanager" xmlns:mm0="http://fedorahosted.org/mirrormanager">
<files>
<file name="repomd.xml">
<mm0:timestamp>1609464721</mm0:timestamp>
<size>3102</size>
<verification>
<hash type="md5">f14e20b89fd948bad1c86823291d68b8</hash>
<hash type="sha1">ed6e1fb06988e55a005f5efb33b15333e5dc37ff</hash>
<hash type="sha256">a29f3dfe36d3413ded9c1e625432167793d8ec1a818676cc5eeb7b095b5f5d24</hash>
<hash type="sha512">b827c7823ed6c84849b879fc29a7a0b7726be320d8837edddb0a834497cba3f5139a1fafa998da1cd7d1fba3ba6007e20e75b37ce901c02f4572d6ab39a25002</hash>
</verification>
<resources maxconnections="1">
<url protocol="http" type="http" location="CN" preference="100">http://我的epelhttp服务器dns/epel/8/Modular/x86_64/repodata/repomd.xml</url>
</resources>
</file>
</files>
</metalink>
最重要就是要从 metalink data 中获取下面这段信息, 而这个就是我的 epel http 可以访问的地址
<url protocol="http" type="http" location="CN" preference="100">http://我的epelhttp服务器dns/epel/8/Modular/x86_64/repodata/repomd.xml</url>
注意
由于这个是自己写的 metadatalink , 因此, 你不可以直接复制 官方 epel 的 sha512 码
当客户端检测到错误的 sha512 码以后, 会返回下面信息
- Downloading successful, but checksum doesn't match. Calculated: b827c7823ed6c84849b879fc29a7a0b7726be320d8837edddb0a834497cba3f5139a1fafa998da1cd7d1fba3ba6007e20e75b37ce901c02f4572d6ab39a25002(sha512) Expected: af6e48f0df298502453626708046df7def214e1f81cfcfef92359b7a044e1fcd739d9d8ae4d8d099a67bd645194a1983cb8d7b1e1c5ee4d0aa63be97dafa2ce3(sha512)
根据上面提示知道
当前的 sha512 是 b827c7823ed6c84849b879fc29a7a0b7 。。。。。。。。
而服务器配置的 metalink 上写的是 af6e48f0df29850245362670804。。。。
你只需要复制 b827c7823ed6c84849b879fc29a7a0b7 。。。。。。。。 替换到 metalink 返回即可完美创建私有 epel repo
notice
https://mirrors.bfsu.edu.cn/epel/7/x86_64/
https://admin.fedoraproject.org/mirrormanager/mirrors/EPEL
本文介绍了如何在CentOS 8系统上建立EPEL私有仓库,包括安装EPEL-release,使用rsync同步EPEL RPM,设置本地HTTPD服务器,并创建自定义metalink文件以实现本地共享和验证。
889

被折叠的 条评论
为什么被折叠?



