1. 安装apt-mirror
apt-get install apt-mirror
2. 配置apt-mirror
vim /etc/apt/mirror.list
2.1 下载目录什么的基础配置建议使用默认。
2.2 deb 配置的是拖库的目标地址 //次配置中选择的是163镜像站。
############# 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://mirrors.163.com/debian/ jessie main non-free contrib deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib deb-src http://mirrors.163.com/debian/ jessie main non-free contrib deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
3. 拖库
apt-mirror
此例子中的配置共需下载140+个GB的文件。
4. 发布
4.1 安装apache服务器
apt-get install apache2
4.2 链接
ln -s /var/spool/apt-mirror/mirror/mirrors.163.com/debian /var/www/html/debian
OK,至此apt-mirror服务器搭建完成。
5. 使用
切换至测试机器
5.1 vim /etc/apt/sources.list
22 #deb http://mirrors.163.com/debian/ jessie main non-free contrib 23 #deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib 24 #deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib 25 26 deb http://192.168.25.138/debian/ jessie main non-free contrib 27 deb http://192.168.25.138/debian/ jessie-updates main non-free contrib 28 deb-src http://192.168.25.138/debian/ jessie main non-free contrib
注:192.168.25.138为apt-mirror服务器的地址。
5.2 更新本地配置
apt-get update
5.3 安装测试
apt-get install 测试软件包名
如果识别并安装成功,恭喜你,从此再也不用担心外网网速了。
时间: 2024-11-14 12:29:44