linux本地搭建apt源

使用apt-mirror搭建

1.安装

bash 复制代码
apt-get install apt-mirror

2.编辑配置文件

bash 复制代码
vi /etc/apt/mirror.list

修改下载目录

set_base_path 后面改为下载镜像的目录,同时删除前面#号

添加同步的源,建议用国内的,速度快,我这里用的阿里云的镜像源

我这里只同步debian12的,如果需要ubuntu或者别的,填别的源

3.运行

bash 复制代码
apt-mirror

同步时间较长

4.其他机器使用

bash 复制代码
vi /etc/apt/sources.list

填上你的服务器的ip地址

bash 复制代码
deb http://192.168.x.x/mirror/deb.debian.org/debian bookworm main contrib non-free
deb http://192.168.x.x/mirror/deb.debian.org/debian-security bookworm-security main contrib non-free

5.每天定时更新

配置crotab

bash 复制代码
crontab -e

每天2点更新,并将输出日志保存到 /var/spool/apt-mirror/var/cron.log

bash 复制代码
0 2 * * * /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log

如果默认打开的是nano编辑器,ctrl+o ctrl+x保存退出即可

相关推荐
Lw老王要学习2 分钟前
Linux架构篇、第五章git2.49.0部署与使用
linux·运维·git·云计算·it
showmethetime15 分钟前
搭建高可用及负载均衡的Redis
运维·redis·负载均衡
上天_去_做颗惺星 EVE_BLUE1 小时前
Docker入门教程:常用命令与基础概念
linux·运维·macos·docker·容器·bash
孙克旭_7 小时前
PXE_Kickstart_无人值守自动化安装系统
linux·运维·自动化
π大星星️9 小时前
HAProxy + Keepalived + Nginx 高可用负载均衡系统
运维·nginx·负载均衡
IT专业服务商10 小时前
联想 SR550 服务器,配置 RAID 5教程!
运维·服务器·windows·microsoft·硬件架构
UpUpUp……13 小时前
Linux--JsonCpp
linux·运维·服务器·c++·笔记·json
Clockwiseee13 小时前
文件上传总结
运维·服务器·学习·文件上传
liyi_hz200813 小时前
O2OA(翱途)开发平台系统安全-用户登录IP限制
运维·服务器·网络·o2oa开发
武汉格发Gofartlic14 小时前
FEKO许可证的安全与合规性
大数据·运维·安全