用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
edmund_xu
帖子: 4
注册时间: 2021-11-12 9:22
系统: ubuntu,rhel

用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#1

帖子 edmund_xu » 2021-11-12 9:41

公司内网环境,只有一台可连外网的centos服务器,用这台通外网服务器 apt-mirror 了华为云的源,起了个 http 服务,然后其他内网机器去同步这个内网源, apt update 报错,大佬们看看什么原因,吐了,搞两天了

以下是报错信息:
忽略:95 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe DEP-11 48x48 Icons
忽略:96 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe DEP-11 64x64 Icons
忽略:97 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe DEP-11 64x64@2 Icons
忽略:98 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe amd64 c-n-f Metadata
忽略:99 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/multiverse i386 Packages
忽略:102 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata
忽略:103 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/multiverse DEP-11 48x48 Icons
忽略:104 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/multiverse DEP-11 64x64 Icons
忽略:105 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/multiverse DEP-11 64x64@2 Icons
忽略:106 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/multiverse amd64 c-n-f Metadata
忽略:80 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/main i386 Packages
忽略:82 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/main amd64 DEP-11 Metadata
错误:83 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/main DEP-11 48x48 Icons
404 Not Found [IP: 10.4.48.10 80]
忽略:84 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/main DEP-11 64x64 Icons
忽略:85 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/main DEP-11 64x64@2 Icons
忽略:86 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/main amd64 c-n-f Metadata
忽略:87 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/restricted i386 Packages
忽略:90 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/restricted amd64 c-n-f Metadata
忽略:92 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe i386 Packages
忽略:94 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe amd64 DEP-11 Metadata
忽略:95 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe DEP-11 48x48 Icons
忽略:96 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe DEP-11 64x64 Icons
忽略:97 http://10.4.48.10/ubuntu2004/mirror/rep ... com/ubuntu focal-security/universe DEP-11 64x64@2 Icons
已下载 593 kB,耗时 2秒 (325 kB/s)
正在读取软件包列表... 完成
E: 无法下载 http://10.4.48.10/ubuntu2004/mirror/rep ... ands-amd64 404 Not Found [IP: 10.4.48.10 80]
E: 无法下载 http://10.4.48.10/ubuntu2004/mirror/rep ... tion-en.xz 文件尺寸不符(188864 != 188096)。您使用的镜像正在同步中? [IP: 10.4.48.10 80]
Hashes of expected file:
- Filesize:188096 [weak]
- SHA256:5ad72badedada3e8664fecc5d44e3f04fd19c0191c3c0998533e8f70853ba564
- SHA1:0050a6fee6ea5601ad75c25c86d449f70969444a [weak]
- MD5Sum:642c1e807f659111c7e1f2d85bdc4ab1 [weak]
Release file created at: Wed, 10 Nov 2021 01:22:24 +0000
E: 无法下载 http://10.4.48.10/ubuntu2004/mirror/rep ... ands-amd64 404 Not Found [IP: 10.4.48.10 80]
E: 无法下载 http://10.4.48.10/ubuntu2004/mirror/rep ... -48x48.tar 404 Not Found [IP: 10.4.48.10 80]
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。



以下是apt-mirror配置:

############# config ##################
## 以下注释的内容都是默认配置,如果需要自定义,取消注释修改即可
set base_path /yum-repo/ubuntu2004
##
## 镜像文件下载地址
set mirror_path $base_path/mirror
## 临时索引下载文件目录,也就是存放软件仓库的dists目录下的文件(默认即可)
set skel_path $base_path/skel
## 配置日志(默认即可)
set var_path $base_path/var
## clean脚本位置
set cleanscript $var_path/clean.sh
## 架构配置,i386/amd64,默认的话会下载跟本机相同的架构的源
set defaultarch amd64
set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
## 下载线程数
set nthreads 20
set _tilde 0
##
############## end config ##############
## (这里没有添加deb-src的源)
deb https://repo.huaweicloud.com/ubuntu/ focal main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ focal-security main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ focal-proposed main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ focal-backports main restricted universe multiverse

clean https://repo.huaweicloud.com/ubuntu/
头像
astolia
论坛版主
帖子: 6536
注册时间: 2008-09-18 13:11

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#2

帖子 astolia » 2021-11-12 11:09

apt-mirror这个工具比较旧了,不认识新的cnf和dep11目录,你需要手动下载,可以参考 https://www.linuxtechi.com/setup-local- ... er-ubuntu/ 里面的cnf目录下载脚本

至于那个尺寸不符的问题,先重新同步一下。如果还遇到,去看一下官方源和华为源里面报问题的文件是否一致,有可能是华为源的同步问题
edmund_xu
帖子: 4
注册时间: 2021-11-12 9:22
系统: ubuntu,rhel

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#3

帖子 edmund_xu » 2021-11-12 13:57

astolia 写了: 2021-11-12 11:09 apt-mirror这个工具比较旧了,不认识新的cnf和dep11目录,你需要手动下载,可以参考 https://www.linuxtechi.com/setup-local- ... er-ubuntu/ 里面的cnf目录下载脚本

至于那个尺寸不符的问题,先重新同步一下。如果还遇到,去看一下官方源和华为源里面报问题的文件是否一致,有可能是华为源的同步问题
老哥,那我这种环境有更好的建本地源的方式吗 :Adore
头像
astolia
论坛版主
帖子: 6536
注册时间: 2008-09-18 13:11

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#4

帖子 astolia » 2021-11-12 19:28

你可以直接用rsync来同步,参考 https://help.ubuntu.com/community/Rsyncmirror
edmund_xu
帖子: 4
注册时间: 2021-11-12 9:22
系统: ubuntu,rhel

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#5

帖子 edmund_xu » 2021-11-12 20:13

astolia 写了: 2021-11-12 19:28 你可以直接用rsync来同步,参考 https://help.ubuntu.com/community/Rsyncmirror
看文章内容说rsync是全量下载了,没那么大空间 :Sad
edmund_xu
帖子: 4
注册时间: 2021-11-12 9:22
系统: ubuntu,rhel

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#6

帖子 edmund_xu » 2021-11-13 8:45

astolia 写了: 2021-11-12 19:28 你可以直接用rsync来同步,参考 https://help.ubuntu.com/community/Rsyncmirror
我用apt-mirror貌似成功了,感谢,不过我现在只mirror了amd64的软件包,但是其他服务器去apt update的时候还是会去索引i386的包,怎么能不让它去索引i386的呢
头像
astolia
论坛版主
帖子: 6536
注册时间: 2008-09-18 13:11

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#7

帖子 astolia » 2021-11-13 11:13

edmund_xu 写了: 2021-11-13 8:45 我用apt-mirror貌似成功了,感谢,不过我现在只mirror了amd64的软件包,但是其他服务器去apt update的时候还是会去索引i386的包,怎么能不让它去索引i386的呢
在其他服务器的/etc/apt/sources.list里,加个参数指定架构就行

代码: 全选

deb [arch=amd64] http://10.4.48.10/ubuntu2004/mirror/repo.huaweicloud.com/ubuntu ****
qadqingkong
帖子: 103
注册时间: 2011-07-02 11:08

Re: 用一台通外网的内网机器apt-mirror外网源,内网其他机器去update报错

#8

帖子 qadqingkong » 2021-12-21 15:22

就是少那几个文件 弄个脚本 wget取一下就行了

但是 我到今年年中发现好像20.04不下那几个也行了
回复