proxmox-offline-mirror使用

安装

apt update
apt install proxmox-offline-mirror
创建镜像
直接使用向导式命令行创建proxmox-offline-mirror setup,然后按照步骤一步一步完成即可,完成后内容会写到/etc/proxmox-offline-mirror.cfg
也可以使用命令手工添加config mirror add,例如
proxmox-offline-mirror config mirror add \
 --id debian-bookworm-security \
 --architectures amd64 \
 --architectures all \
 --repository 'deb http://deb.debian.org/debian-security bookworm-security main contrib non-free' \
 --key-path /etc/apt/trusted.gpg.d/debian-archive-bookworm-security-automatic.gpg \
 --sync true \
 --verify true \
 --base-dir /path/to/mirror/base-dir

  

/etc/proxmox-offline-mirror.cfg文件内容如下
 

 

里面的base-dir是个基目录,创建的镜像仓库都位于基目录下

 创建完成后,使用

proxmox-offline-mirror mirror snapshot create debian-bookworm-security,同步debian-bookworm-security仓库
可以指明配置文件来执行proxmox-offline-mirror mirror snapshot create-all --config '/etc/proxmox-offline-mirror.cfg',create-all将同步配置文件所有镜像仓库
如下命令只同步pve仓库 proxmox-offline-mirror mirror snapshot create --config '/etc/proxmox-offline-mirror.cfg' 'pve-subscription' ,
可以修改最后的mirror名称pve-subscription来单独同步其他的仓库



使用内网来做离线源
nginx配置根目录为镜像目录

 在机器上修改apt源为nginx地址,格式如下

deb [ check-valid-until=false ] http://proxmox-offline-mirror.domain.example/<mirror-name>/<snapshot-timestamp> <codename> <suite>
 

 

修改/etc/apt/source.list内容为如下即可使用离线源

deb http://192.168.2.2/pve-subscription/2025-05-07T01:05:10Z  bookworm pve-no-subscription

url连接写到dists上层目录即可,后面紧跟debian版本和项目名称即可

 

 本地文件挂载格式

deb [check-valid-until=false] file:///mnt/mirror-path/<mirror-name>/<snapshot-timestamp> <codename> <suite>
 
 创建镜像快照的时候,每次创建都会产生一个时间错目录,我们可以删除旧的目录,只保存新的目录即可,快照使用了硬链接的方式来确保文件只保存一份,删除旧的不会影响释放更多的空间,也不会对新的有什么影响。
你可以调用proxmox-offline-mirror mirror gc来释放没有硬连接使用的文件,来释放空间

 https://forum.proxmox.com/threads/proxmox-offline-mirror-released.115219/page-6

 

 

 

 

root@nodes01:/etc/apt# cat /etc/apt/sources.list.d/pve-enterprise.list 
#deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise
deb http://10.20.19.193/pve-subscription/2025-05-07T01:05:10Z  bookworm pve-no-subscription
root@nodes01:/etc/apt# cat sources.list
#deb http://ftp.debian.org/debian bookworm main contrib

#deb http://ftp.debian.org/debian bookworm-updates main contrib

# security updates
#deb http://security.debian.org bookworm-security main contrib
deb http://10.20.19.193/debian_bookworm_main/2025-05-07T01:06:43Z bookworm main contrib
deb http://10.20.19.193/debian_bookworm_security/2025-05-07T01:08:16Z bookworm-security main contrib
deb http://10.20.19.193/debian_bookworm_updates/2025-05-07T01:58:51Z bookworm-updates main contrib

 

posted @ 2025-05-07 09:50  mofy  阅读(64)  评论(0)    收藏  举报