linux运维篇-Ubuntu(debian)系操作系统创建源仓库

发布于:2025-04-20 ⋅ 阅读:(19) ⋅ 点赞:(0)

适用范围

适用于Ubuntu(Debian)及其衍生版本的linux系统
例如,国产化操作系统kylin-desktop-v10

简介

先来看下我们需要创建出来的仓库目录结构
在这里插入图片描述

Deb_conf_test

apt源的主目录

conf

配置文件存放目录
conf目录下存放两个配置文件:
distributions文件: 存放本地仓库信息

#组织机构
origin: local_apt
#知识库
Label: local
#对应系统的发行版代号
Codename: local
#用于定义如何从外部仓库同步更新本地仓库
Update: sink
#要同步的架构(amd64 arm64 i386)
Architectures: amd64
#要同步的组件(main, restricted, universe, multiverse)
Components: main
#描述,说明
Description: the test repo of local
#公钥
SignWith:  6B7FC1801B1 734DEAFCF 782F3A805B095AE7DE78 
#UDebComponents在apt系包管理系统中用于标识仓库的不同部分,例如:‌main‌:包含官方支持的自由软件;‌contrib‌:包含由第三方提供的软件包,但这些软件包与Debian项目有某种形式的合作关系;non-free‌:包含不受版权限制的软件包,可能包括非自由软件
UDebComponents: main
#日志
Log: local_apt.log

updates文件: 存放仓库同步配置信息

#更新规则的名称(需与 distributions 中的 Update 匹配)
Name: sink
#要同步的仓库版本
Suite: 
#外部仓库的 URL(支持 http、https、ftp)
Method:https://archive.xxxxxx.com/xxxxxx
#要同步的架构
Architectures : amd64
#要同步的组件(main, restricted, universe, multiverse)
Components: main
#Method是我自己搭建的web服务所建立的仓库地址
Method: http://127.0.0.1/data/Deb_conf_test
#验证外部仓库的 GPG 密钥指纹
VerifyRelease: xxxxxxxx

注意:这里仅对update方式做介绍,实际并没有配置update同步

操作步骤:

  1. 安装必要软件,gpg和reprepro
sudo apt install gpg reprepro
  1. 生成公钥
    在这里插入图片描述
  2. 创建对应的目录
mkdir -p /data/Deb_conf_test/conf
  1. 创建distributions文件
touch /data/Deb_conf_test/confdistributions

5.写入以下配置

#组织机构
origin: local_apt
#知识库
Label: local
#对应系统的发行版代号
Codename: local
#要同步的架构(amd64 arm64 i386)
Architectures: amd64
#要同步的组件(main, restricted, universe, multiverse)
Components: main
#描述,说明
Description: the test repo of local
#公钥
SignWith:  56477269E4E90D0ABAFC0E6005402A8EC6BFF10E
#UDebComponents在apt系包管理系统中用于标识仓库的不同部分,例如:‌main‌:包含官方支持的自由软件;‌contrib‌:包含由第三方提供的软件包,但这些软件包与Debian项目有某种形式的合作关系;non-free‌:包含不受版权限制的软件包,可能包括非自由软件
UDebComponents: main
#日志
Log: local_apt.log
  1. 适用reprepro工具来对DEB仓库进行添加、删除

注意:使用reprepro命令必须在/data/Deb_conf_test/目录下,否则会报错

使用apt download命令下载几个软件包做测试

apt download zip tree

添加软件包

reprepro includedeb local /home/kylin/tree_1.8.0-1_amd64.deb /home/kylin/zip_3.0-11build1_amd64.deb

在这里插入图片描述
在这里插入图片描述

删除软件包

reprepro remove local tree

在这里插入图片描述


网站公告

今日签到

点亮在社区的每一天
去签到