ubuntu18本地镜像源_Ubuntu 18.04 搭建私有软件镜像源(支持 Ubuntu 和 CentOS)

系统环境为 Ubuntu 18.04,搭建支持 Ubuntu 系和 CentOS 系的双私有软件仓库。

Ubuntu 本地软件镜像源使用 apt-mirror 工具与远程仓库同步,CentOS 本地镜像源使用 reposync 工具与远程仓库同步。

上述两个工具都可以通过 Ubuntu 的包管理器 apt-get 命令直接安装使用。

一、环境准备

我这里搭建了 Ubuntu 18.04、Ubuntu 16.04 和 CentOS7 三个镜像源,从远程仓库拉取的软件包总共耗费了约 300G 硬盘空间,其中两个 Ubuntu 占用了约 261G,CentOS7(包含 epel 源)约 29G 。

创建镜像源前需保证本地有足够的存储空间。

建议给磁盘分区时使用 LVM(逻辑卷管理) 的方式,便于之后对存储空间进行扩容等操作。

关于 Linux 系统磁盘分区和 LVM 的介绍可以参考 Linux 磁盘设备和 LVM 管理命令详解。此处不作赘述。

安装同步工具:

$ sudo apt-get install apt-mirror reposync createrepo

安装 web 服务器(nginx):

$ sudo apt-get install nginx

二、Ubuntu 镜像源搭建

编辑 /etc/apt/mirror.list 配置文件,修改远程仓库的地址为国内的阿里镜像站,本地的 Ubuntu 软件仓库将定期从阿里源同步软件包。

set nthreads 20

set _tilde 0

set base_path /opt/mirrors/ubuntu

set defaultarch amd64

#Ubuntu 16.04

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

#Ubuntu 18.04

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

上述配置文件中 base_path 指定的

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值