Created
December 13, 2012 03:04
-
-
Save iandexter/4273697 to your computer and use it in GitHub Desktop.
Create a local EPEL mirror <http://blog.iandexter.net/2012/12/create-local-epel-mirror.html>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yum install httpd yum-utils createrepo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cat > reposync.patch | |
| --- /usr/bin/reposync.bak 2012-11-13 13:30:37.000000000 +0800 | |
| +++ /usr/bin/reposync 2012-11-13 13:34:47.000000000 +0800 | |
| @@ -117,6 +117,8 @@ def parseArgs(): | |
| help="enable yum plugin support") | |
| parser.add_option("-m", "--downloadcomps", default=False, action="store_true", | |
| help="also download comps.xml") | |
| + parser.add_option("-f", "--flatdir", dest='flatdir', default=False, action="store_true", | |
| + help="flatten directory; do not add repoid") | |
| (opts, args) = parser.parse_args() | |
| return (opts, args) | |
| @@ -186,7 +188,11 @@ def main(): | |
| else: | |
| download_list = list(reposack) | |
| - local_repo_path = opts.destdir + '/' + repo.id | |
| + if opts.flatdir: | |
| + local_repo_path = opts.destdir; | |
| + else: | |
| + local_repo_path = opts.destdir + '/' + repo.id | |
| + | |
| if opts.delete and os.path.exists(local_repo_path): | |
| current_pkgs = localpkgs(local_repo_path) | |
| cp /usr/bin/reposync{,.bak} | |
| patch < reposync.patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir -p /srv/repos/epel{,.staging}/5/{x86_64,i386,noarch} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reposync -a x86_64 -r epel -p /srv/repos/epel.staging -l -m -f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd /srv/repos/epel.staging/ | |
| for a in {x86_64,i386,noarch} ; do \ | |
| find . -maxdepth 1 -iname "*$a*" -exec cp -v {} 5/$a/ \; ; \ | |
| cp -f comps.xml 5/$a/ ; | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for a in {x86_64,i386,noarch} ; do \ | |
| createrepo -v -g comps.xml 5/$a/ ; \ | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [epel] | |
| name=Extra Packages for Enterprise Linux 5 - $basearch | |
| baseurl=http://fqdn.of.repo.server/epel/5/$basearch | |
| ### mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch | |
| failovermethod=priority | |
| enabled=1 | |
| gpgcheck=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost _default_:80> | |
| ServerAdmin admin@email.org | |
| ServerName fqdn.of.repo.server | |
| DocumentRoot /srv/repos | |
| KeepAlive On | |
| KeepAliveTimeout 2 | |
| MaxKeepAliveRequests 100 | |
| AddType application/octet-stream .iso | |
| AddType application/octet-stream .rpm | |
| <Directory "/srv/repos"> | |
| Options +Indexes +FollowSymLinks | |
| AllowOverride None | |
| Order allow,deny | |
| Allow from all | |
| </Directory> | |
| <LocationMatch "\.(xml|xml\.gz|xml\.asc|sqlite)$"> | |
| Header set Cache-Control "must-revalidate" | |
| ExpiresActive On | |
| ExpiresDefault "now" | |
| </LocationMatch> | |
| LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" %I %O \"%{User-Agent}i\"" combined | |
| </VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment