1、安装apt-mirror
apt install apt-mirror
2、配置mirror.list
vim /etc/apt/mirror.list
############# config ##################
#
# set base_path /var/spool/apt-mirror
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
#deb http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-src http://ftp.us.debian.org/debian unstable main contrib non-free
#需要同步的debian源
deb http://mirrors.aliyun.com/debian stable main contrib non-free
deb http://mirrors.aliyun.com/debian stable-proposed-updates main contrib non-free
deb http://mirrors.aliyun.com/debian stable-updates main contrib non-free
#deb-src http://mirrors.aliyun.com/debian stable main contrib non-free
#deb-src http://mirrors.aliyun.com/debian stable-proposed-updates main contrib non-free
#deb-src http://mirrors.aliyun.com/debian stable-updates main contrib non-free
# mirror additional architectures
#deb-alpha http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-amd64 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-armel http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-hppa http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-i386 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-ia64 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-m68k http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-mips http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-mipsel http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-powerpc http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-s390 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-sparc http://ftp.us.debian.org/debian unstable main contrib non-free
clean http://ftp.us.debian.org/debian
3、同步软件包
apt-mirror
4、发布到web服务
4.1 安装apache服务器
apt-``get`` install apache2
如果使用的centos系统,执行yum install httpd
4.2 链接
ln -s /``var``/spool/apt-mirror/mirrormirrors.aliyun.com/debian /``var``/www/html/debian
5、使用
切换至测试机器vim /etc/apt/sources.list
deb http://localhost/debian stable main contrib non-free
deb http://localhost/debian stable-proposed-updates main contrib non-free
deb http://localhost/debian stable-updates main contrib non-free
apt update
apt install vim