ubuntu下的apt内网本地源 搭建
ubuntu查看版本号命令:
sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
uname -a
Linux 123 5.3.0-42-generic #34~18.04.1-Ubuntu SMP Fri Feb 28 13:42:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
cat /proc/version
Linux version 5.3.0-42-generic (buildd@lcy01-amd64-019) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #34~18.04.1-Ubuntu SMP Fri Feb 28 13:42:26 UTC 2020
1、安装apt-mirror
apt-get install apt-mirror
2、修改apt-mirror配置文件
在修改配置文件之前,我们首先要确定自己系统的版本,命令:sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Codename代号的意思,
6.04代号xenial
14.04代号trusty
18.04代号bionic
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
更改配置文件
vim /etc/apt/mirror.list
配置文件:
# 以下注释的内容都是默认配置,如果需要自定义,取消注释修改即可
set base_path /home/test/ubuntu ----下载路径
#
# 镜像文件下载地址
# set mirror_path $base_path/mirror
# 临时索引下载文件目录,也就是存放软件仓库的dists目录下的文件(默认即可)
# set skel_path $base_path/skel
# 配置日志(默认即可)
# set var_path $base_path/var
# clean脚本位置
# set cleanscript $var_path/clean.sh
# 架构配置,i386/amd64,默认的话会下载跟本机相同的架构的源
set defaultarch amd64
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
# 下载线程数
set nthreads 20
set _tilde 0
#
############# end config ##############
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
clean http://mirrors.aliyun.com/ubuntu
3、开始同步
执行 apt-miiror
会出现类似倒计时一样 20 19 18
下载大约135G左右,所以下载目录空间要够。
4、安装apache2
apt-get install apache2
Apache2的默认网页文件目录位于/var/www/html,可以做个软链接
ln -s
/home/test/ubuntu
/mirror/mirrors.aliyun.com/ubuntu /var/www/html/ubuntu
通过ip地址访问
ip是配置apache2的电脑 port:端口默认80
客户端配置:
1、编辑/etc/apt/source.list,参考以下内容(以下是64位机,ubuntu18.04),修改相应的代号,硬件架构arch,加入文件
# Local Source
deb [arch=amd64] http://192.168.64.156/ubuntu/ xenial main restricted universe multiverse
deb [arch=amd64] http://192.168.64.156/ubuntu/ xenial-security main restricted universe multiverse
deb [arch=amd64] http://192.168.64.156/ubuntu/ xenial-updates main restricted universe multiverse
deb [arch=amd64] http://192.168.64.156/ubuntu/ xenial-proposed main restricted universe multiverse
deb [arch=amd64] http://192.168.64.156/ubuntu/ xenial-backports main restricted universe multiverse
2、更新apt-get源
sudo apt-get update
sudo apt-get upgrade
参考文章:https://www.jianshu.com/p/3e3f34f0ac03
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类