用reposync创建YUM镜像

162次阅读
没有评论

共计 3200 个字符,预计需要花费 8 分钟才能阅读完成。

reposync   通过YUM下载安装包的方式同步远程YUM存储库到本地目录

用法:
reposync [options]
选项:
Options:
  -h, --help            show this help message and exit
  -c CONFIG, --config=CONFIG
                        config file to use (defaults to /etc/yum.conf)
  -a ARCH, --arch=ARCH  act as if running the specified arch (default: current
                        arch, note: does not override $releasever)
  -r REPOID, --repoid=REPOID
                        specify repo ids to query, can be specified multiple
                        times (default is all enabled)
  -e CACHEDIR, --cachedir=CACHEDIR
                        directory in which to store metadata
  -t, --tempcache       Use a temp dir for storing/accessing yum-cache
  -d, --delete          delete local packages no longer present in repository
  -p DESTDIR, --download_path=DESTDIR
                        Path to download packages to: defaults to current dir
  -g, --gpgcheck        Remove packages that fail GPG signature checking after
                        downloading
  -u, --urls            Just list urls of what would be downloaded, don't
                        download
  -n, --newest-only     Download only newest packages per-repo
  -q, --quiet           Output as little as possible
  -l, --plugins         enable yum plugin support
使用以下命令重构元数据是很简单的 createrepos
同步rubyera存储库的示例用法。
$ reposync --repoid=rubyera 
rubyera                                              | 3.2 kB     00:00 ... 
[rubyera: 1     of 14    ] Downloading dhcp_probe-1.3.0-2.fc13.x86_64.rpm
[rubyera: 2     of 14    ] Downloading dhcp_probe-1.3.0-4.fc13.x86_64.rpm
[rubyera: 3     of 14    ] Downloading dhcp_probe-1.3.0-3.fc13.x86_64.rpm
[rubyera: 4     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-2.fc13.x86_64.rpm
[rubyera: 5     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-4.fc13.x86_64.rpm
[rubyera: 6     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-3.fc13.x86_64.rpm
[rubyera: 7     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-1.fc13.x86_64.rpm
[rubyera: 8     of 14    ] Downloading iptables-1.4.5-1.fc12.x86_64.rpm
[rubyera: 9     of 14    ] Downloading iptables-debuginfo-1.4.5-1.fc12.x86_64.rpm
[rubyera: 10    of 14    ] Downloading iptables-devel-1.4.5-1.fc12.x86_64.rpm
[rubyera: 11    of 14    ] Downloading iptables-ipv6-1.4.5-1.fc12.x86_64.rpm
[rubyera: 12    of 14    ] Downloading passenger-2.2.15-1.fc13.x86_64.rpm
[rubyera: 13    of 14    ] Downloading passenger-debuginfo-2.2.15-1.fc13.x86_64.rpm
[rubyera: 14    of 14    ] Downloading rubygem-pg-0.9.0-1.fc13.x86_64.rpm
如果你再次尝试同步, reposync 不会下载现有的软件包,节省带宽。
$ reposync --repoid=rubyera 
[rubyera: 1     of 14    ] Skipping existing dhcp_probe-1.3.0-2.fc13.x86_64.rpm
[rubyera: 2     of 14    ] Skipping existing dhcp_probe-1.3.0-4.fc13.x86_64.rpm
[rubyera: 3     of 14    ] Skipping existing dhcp_probe-1.3.0-3.fc13.x86_64.rpm
[rubyera: 4     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-2.fc13.x86_64.rpm
[rubyera: 5     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-4.fc13.x86_64.rpm
[rubyera: 6     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-3.fc13.x86_64.rpm
[rubyera: 7     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-1.fc13.x86_64.rpm
[rubyera: 8     of 14    ] Skipping existing iptables-1.4.5-1.fc12.x86_64.rpm
[rubyera: 9     of 14    ] Skipping existing iptables-debuginfo-1.4.5-1.fc12.x86_64.rpm
[rubyera: 10    of 14    ] Skipping existing iptables-devel-1.4.5-1.fc12.x86_64.rpm
[rubyera: 11    of 14    ] Skipping existing iptables-ipv6-1.4.5-1.fc12.x86_64.rpm
[rubyera: 12    of 14    ] Skipping existing passenger-2.2.15-1.fc13.x86_64.rpm
[rubyera: 13    of 14    ] Skipping existing passenger-debuginfo-2.2.15-1.fc13.x86_64.rpm
[rubyera: 14    of 14    ] Skipping existing rubygem-pg-0.9.0-1.fc13.x86_64.rpm
个示例是为fedora和fedora-updates存储库创建本地镜像,并将它们本地化。以这种方式安装和升级软件包将非常快速。重要的是保持本地镜像与主存储库每小时运行一次 reposync 和 createrepo需要注意的是,安装包文件不是由reposync下载的,而是用 wget 或 curl下载。
使用 reposync 的好处之一与使用 rsync、ftp 或http 镜像不同,reposync 使用的是镜像站列表。就是说他会从你的下载服务器中的镜像站的列表中去下载,如果实在自动尝试下一个镜像站,而 rsync、ftp或http,都需要手动维护,从一个服务器下载,用 reposync 是完全透明的,并且易于处理故障。
正文完
掃描進入電報群 https://t.me/+R_Tv2n6ReZCjk10G
post-qrcode
 
ifset
版权声明:本站原创文章,由 ifset 2023-05-27发表,共计3200字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码