ubuntu配置本地apt仓库
发行信息
- 代号取
Code name
前一个单词缩写 - 官方版本信息
apt-mirror
-
作用:同步工具
-
安装:
apt install apt-mirror -y
-
安装完成后,会生成文件
/etc/apt/mirror.list
,最好备份一份
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://archive.ubuntu.com/ubuntu artful main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu artful-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu artful-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu artful-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu artful-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu artful main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu artful-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu artful-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu artful-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu artful-backports main restricted universe multiverse
clean http://archive.ubuntu.com/ubuntu
自用ubuntu1804使用的配置:
-
请确认默认的
base_path
空间足够,否则请更换路径 -
增加
arch
字段,这样下载的包更全,如有需要,可再添加arm64
,用以下载arm
包,对应的地址也需要修改为http://archive.ubuntu.com/ubuntu-ports/
-
默认使用官方源,使用
nload
命令可以查看网速,如果速度慢的话可以尝试替换为下方国内源。建议还是使用官方源,实测即使换成国内源将线程改大,下载速度依然是
20MB
左右,且国内源会报一些错误mirrors.tuna.tsinghua.edu.cn
mirrors.ustc.edu.cn
############# 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 [arch=amd64] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb [arch=i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb [arch=i386] http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb [arch=i386] http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb-src [arch=amd64] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb-src [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb-src [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb-src [arch=i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb-src [arch=i386] http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb-src [arch=i386] http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
clean http://archive.ubuntu.com/ubuntu
开始同步
使用screen命令,开启会话,放至中断,然后执行apt-mirror
即可,大概需要300GB左右的数据
客户端配置
- 根据自己的下载路径,替换
file:///root/mirror/archive.ubuntu.com/ubuntu
deb [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb-src [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb-src [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb-src [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
deb-src [arch=amd64] file:///root/mirror/archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现