方法一:支持rsync的网站 

对于常用的centos、Ubuntu、等使用官方yum源在 http://mirrors.ustc.edu.cn 都存在镜像。

  同时 http://mirrors.ustc.edu.cn 网站又支持 rsync 协议, 可以通过rsync实现 镜像yum源。

在windows上使用rsync需要用到 cwRsync  下载地址是 https://www.itefix.net/dl/cwRsync_5.5.0_x86_Free.zip;

  其官网为 https://www.itefix.net/cwrsync 

使用rsync的时候需要编写脚本,设置要同步的内容

 

其中centos7_base.bat脚本内容 供大家参考:

SET CWRSYNCHOME=%~dp0

IF NOT EXIST %CWRSYNCHOME%home%USERNAME%.ssh MKDIR %CWRSYNCHOME%home%USERNAME%.ssh

SET CWOLDPATH=%PATH%

SET PATH=%CWRSYNCHOME%bin;%PATH%

rsync -av –delete rsync://mirrors.ustc.edu.cn/centos/7/os/x86_64/ /cygdrive/f/yum/nginx/html/centos/7/os/x86_64/

方法二:使用wget命令下载不支持rsync协议的源

# wget -r -p -np -k http://archives.fedoraproject.org/pub/archive/epel/5Server/x86_64/

# wget -r -p -np -k http://archives.fedoraproject.org/pub/epel/6Server/x86_64/

-c, –continue resume getting a partially-downloaded file. 断点续传 -nd, –no-directories dont create directories. 不创建层级目录,所有文件下载到当前目录 -r, –recursive specify recursive download. 递归下载 -p, –page-requisites get all images, etc. needed to display HTML page. 下载页面所有文件,使页面能在本地打开 -k, –convert-links make links in downloaded HTML or CSS point to local files. 转换链接指向本地文件 -np, –no-parent dont ascend to the parent directory. 不下载父级目录的文件 -o, –output-file=FILE log messages to FILE. 指定日志输出文件 -O, –output-document=FILE write documents to FILE. 指定文件下载位置 -L, –relative follow relative links only. 只下载相对链接,如果页面嵌入其他站点不会被下载

windows上wget命令使用方法

  下载:http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe

  官网:http://gnuwin32.sourceforge.net/packages/wget.htm

**  安装**

        双击即可安装,安装到目录:D:\GnuWin32

    

**  修改环境变量**

    右键计算机 -> 属性 -> 高级系统设置 -> 环境变量 -> 系统变量  GNU_HOME=D:\GnuWin32\bin

    

    添加path变量,在cmd中可以使用wget命令。  PATH=;%GNU_HOME%

    

Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

最初由 Hrvoje Niksic <[email protected]> 编写。 Currently maintained by Micah Cowan <[email protected]>.

提供web服务

 同时提供web服务需要用到nginx 

   nginx 下载 页面 http://nginx.org/en/download.html

附:nginx 配置文件

events { worker_connections 1024; }

http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { autoindex on; root html; index index.html index.htm; } } server { listen 80; server_name repo.zabbix.com; location / { autoindex on; root html/zabbix; index index.html index.htm; } } server { listen 80; server_name sp.repo.webtatic.com mirror.webtatic.com; location / { autoindex on; root html/webtatic; index index.html index.htm; } } }

最后使用浏览器访问

  

在linux服务器中设置解析

附件:

附件1、  cwrsync + 全部 bat 脚本  https://files.cnblogs.com/files/clsn/cwRsync.rar

附件2、  nginx + 配置文件  https://files.cnblogs.com/files/clsn/nginx.zip

 

特别感谢:国强哥提供wget命令使用