# 安装必要的软件
sudo apt-get install -y apt-mirror
# 编辑/etc/apt/mirror.list,添加以下内容
set base_path /var/spool/apt-mirror
# 指定要镜像的Ubuntu发布和组件-null
dir jammy-updates main restricted universe multiverse
# 镜像的Ubuntu发布和组件的URL-null
mirror http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
mirror http://archive.ubuntu.com/ubuntu/ jammy-updates main/debian-installer restricted/debian-installer universe/debian-installer multiverse/debian-installer
# 定时任务,每天同步一次
echo "0 5 * * * /usr/bin/apt-mirror" > /etc/cron.d/mirror
# 启动APT镜像过程
/usr/bin/apt-mirror
---------------
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy