内网搭建Ubuntu(银河麒麟)的apt本地源服务器

68 篇文章 61 订阅 ¥19.90 ¥99.00

很多项目要求内网环境,导致服务器不能使用公网的apt源,所以需要在内网中搭建一个本地的apt源。本教程将指导你如何利用apt-mirror建立局域网内的Debian/Ubuntu源镜像。如果你需要在局域网内安装多套系统,那么建立一个本地的Debian/Ubuntu源镜像将会有益,在您更新系统的时候将获得比互联网连接快得多的速度,而且还能节省您的互联网带宽。

一、使用场景

自建镜像站基本有两大使用场景:

  • 提升软件包拉取速度,安装在有大带宽的机器上提供服务;
  • 局域网客户端无外网访问能力,需搭建内网镜像站作为源站。

二、前期准备

你可以在debian和ubuntu系统上建立Debian/Ubuntu源镜像,也就是说,debian系统可以建立Debian和Ubuntu源镜像,ubuntu系统上也能建立Debian和Ubuntu源镜像。

需要注意的是要建立一个源镜像你需要有一个快一点的连接和足够大的硬盘空间。在我的测试过程中我做了一个Debian Sarge的main,contrib 和non-free部分的镜像和 Ubuntu Edgy Eft的 main, restricted, universe部分的镜像,这总共占用了大概25G的硬盘空间,在16M的DSL的带

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要在内网中使用Apache2搭建Apt本地的服务端,可以按照以下步骤进行操作: 1. 安装Apache2和apt-mirror软件包: ``` sudo apt-get update sudo apt-get install apache2 apt-mirror ``` 2. 配置apt-mirror: 在/etc/apt/mirror.list文件中添加以下内容: ``` # 镜像的地址,可以根据需要修改 deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse # 本地存储的路径,可以根据需要修改 clean http://localhost/apt-mirror ``` 3. 执行apt-mirror命令: ``` sudo apt-mirror ``` 这个命令会下载所需的软件包并将其存储在本地路径中。 4. 配置Apache2: 在/etc/apache2/sites-enabled/000-default.conf文件中添加以下内容: ``` Alias /apt-mirror /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu <Directory /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> ``` 5. 重启Apache2: ``` sudo systemctl restart apache2 ``` 现在,您的Apt本地服务端已经搭建完成了。您可以通过以下方式在内网中使用它: 在客户端的/etc/apt/sources.list文件中添加以下内容: ``` deb http://localhost/apt-mirror/archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse deb http://localhost/apt-mirror/archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://localhost/apt-mirror/archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://localhost/apt-mirror/archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse ``` 然后执行以下命令更新软件包列表: ``` sudo apt-get update ``` 现在,您可以在内网中使用Apt本地服务端了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

太极淘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值