diff --git a/mirror/ftpmirror.htm b/mirror/ftpmirror.htm index 34b7cec6f6b2867a06ed826f6aac210ebb82af4a..51232f1a01e2e4046430bde803e3d97edd1bc6e1 100644 --- a/mirror/ftpmirror.htm +++ b/mirror/ftpmirror.htm @@ -28,44 +28,96 @@

https://wiki.debian.org/DebianRepository/Setup#Debian_Repository_Mirroring_Tools

-

- 目前推荐使用 apt-mirror 工具来进行镜像。由于一些条件因素限制,当前镜像软件站点并非运行在标准80和443端口,而是2443端口,所以直接配置apt-mirror软件后会有一些报错且无法运行。原因主要在于apt-mirror会根据配置文件mirror.list中的内容进行参数组装,而其中一个便是http://fun.ie8.pub/atzlinux/....,由于atzlinux并不在80端口有http服务,所以会报错。 -

-

- 经过探索,通过在本地安装nginx服务,将域名fun.ie8.pub解析到本地地址127.0.0.1,由本地nginx在80端口提供跳转服务,借助nginx的redirect功能,实现“http://fun.ie8.pub/atzlinux/...”到“https://fun.ie8.pub:2443/atzlinux/...”的跳转。通过跳转,将apt-mirror访问http 80的服务跳转到https 2443的服务,但是为了实现跳转功能,将域名fun.ie8.pub解析到了本地127.0.0.1,因此当访问https://fun.ie8.pub:2443/的时候,需要借助rinetd实现本地2443端口到真实fun.ie8.pub的tcp代理转发。如此,可以实现正常镜像atzlinux镜像软件的目的。 -

-
  • 配置文件
  • - 在安装 apt-mirror 软件包后,在其配置文件 /etc/apt/mirror.list 加入如下几行:
    -
    +
  • 镜像软件源配置
  • +

    推荐使用 apt-mirror 工具来进行镜像。

    +

    该软件通过加载配置文件 /etc/apt/mirror.list 进行 apt 站点进行同步。该配置文件大概分成三部分,一是本地数据存放路径等变量配置;二是镜像软件源站点信息,该信息与 /etc/apt/sources.list 等 debian 系配置镜像站点类似,但是也有些不同。

    +

    配置中,最重要的是地址信息。由于条件限制,当前 ATZLinux 镜像软件源并非运行在标准80和443端口,而是2443等非标准 HTTP/HTTPS 端口。而 apt-mirror 软件在读取配置过程中,即使配置了非标准端口的 apt 条目,依旧会直接使用标准协议的 HTTP 80 或者 HTTPS 443 端口进行数据拉取,因此也会导致最终 apt-mirror 镜像软件失败。

    +

    基于此,整理配置思路如下:

    + +
    -deb-amd64 https://fun.ie8.pub/atzlinux/ bookworm main contrib non-free non-free-firmware
    -deb-arm64 https://fun.ie8.pub/atzlinux/ bookworm main contrib non-free non-free-firmware
    -deb-i386 https://fun.ie8.pub/atzlinux/ bookworm main contrib non-free non-free-firmware
    -deb-loong64 https://fun.ie8.pub/atzlinux/ bookworm main contrib non-free non-free-firmware
    -deb-riscv64 https://fun.ie8.pub/atzlinux/ bookworm main contrib non-free non-free-firmware
    -deb-amd64 https://fun.ie8.pub/atzlinux/ bullseye main contrib non-free non-free-firmware
    -deb-arm64 https://fun.ie8.pub/atzlinux/ bullseye main contrib non-free non-free-firmware
    -deb-i386 https://fun.ie8.pub/atzlinux/ bullseye main contrib non-free non-free-firmware
    -
    -
  • 配置rinetd
  • -

    -0.0.0.0 2443 fun.ie8.pub 2443 -

    -
  • 配置/etc/hosts
  • -

    -127.0.0.1 fun.ie8.pub -

    -
  • 配置nginx
  • -

    - server { - listen 80; - server_name fun.ie8.pub; - location /atzlinux/ { - return 301 https://fun.ie8.pub:2443$request_uri; - } +配置文件:/etc/nginx/conf.d/fun.ie8.pub.conf,内容如下: + +``` +server { + listen 80; + server_name fun.ie8.pub.local; + location ^~ /atzlinux { + proxy_pass https://fun.ie8.pub:2443/atzlinux/; + proxy_set_header Host fun.ie8.pub; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_ssl_protocols TLSv1.2 TLSv1.3; + proxy_ssl_ciphers 'HIGH:!aNULL:!MD5'; + proxy_ssl_verify off; # Set to 'on' if you have a valid certificate + add_header X-Cache $upstream_cache_status; + access_log /var/log/nginx/fun.ie8.pub.a.log; + error_log /var/log/nginx/fun.ie8.pub.e.log; + } } -

    + + +``` + + + + + +
    +
    +配置文件:/etc/apt/mirror.list,内容如下:
    +
    +```
    +############# config ##################
    +#set base_path    /var/spool/apt-mirror
    +set script_path    /var/spool/apt-mirror
    +set base_path    /data/apt-mirror
    +#
    +set mirror_path  $base_path/mirror
    +set skel_path    $base_path/skel
    +set var_path     $script_path/var
    +set cleanscript $var_path/clean.sh
    +set defaultarch  
    +set postmirror_script $var_path/postmirror.sh
    +set run_postmirror 0
    +set nthreads     20
    +set _tilde 0
    +#
    +############# end config ##############
    +# 以镜像软件站点 https://fun.ie8.pub:2443/atzlinux/ 为例,配置如下:
    +deb-amd64 http://fun.ie8.pub.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +deb-i386 http://fun.ie8.pub.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +deb-arm64 http://fun.ie8.pub.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +deb-loong64 http://fun.ie8.pub.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +deb-riscv64 http://fun.ie8.pub.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +deb-amd64 http://fun.ie8.pub.local/atzlinux/ bullseye  main contrib non-free non-free-firmware
    +deb-arm64 http://fun.ie8.pub.local/atzlinux/ bullseye  main contrib non-free non-free-firmware
    +deb-amd64 http://fun.ie8.pub.local/atzlinux/ buster  main contrib non-free
    +
    +#deb-amd64 http://home.taotieren.com.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +#deb-i386 http://home.taotieren.com.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +#deb-arm64 http://home.taotieren.com.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +#deb-loong64 http://home.taotieren.com.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +#deb-riscv64 http://home.taotieren.com.local/atzlinux/ bookworm main contrib non-free non-free-firmware
    +#deb-amd64 http://home.taotieren.com.local/atzlinux/ bullseye  main contrib non-free non-free-firmware
    +#deb-arm64 http://home.taotieren.com.local/atzlinux/ bullseye  main contrib non-free non-free-firmware
    +#deb-amd64 http://home.taotieren.com.local/atzlinux/ buster  main contrib non-free
    +
    +clean http://fun.ie8.pub/atzlinux/
    +#clean http://home.taotieren.com.local/atzlinux/
    +
    +```
    +
    +
    + +
  • 配置 web 服务
  • 在机器 web 服务端上,加上对 apt-mirror 同步目录别名设置, 将 atzlinux 目录别名设置到 同步的数据目录。
  • 同步频率