1. 需求和环境

需求:满足离线环境下,可以通过apt-get获取kylin软件包.我们通过x86的设备同步软件包,然后构建本地源。

客户端:X86笔记本
客户端OS版本:Ubuntu 20.04.4 LTS x86_64


2. 同步源到本地

2.1 安装apt-mirror

deb源提供了同步工具apt-mirror用于同步基于deb系统(debian/ubuntu)的源。安装软件包如下:

apt-get install apt-mirror

2.2 配置apt-mirror

编辑文件/etc/apt/mirror.list,如下:

# 同步的镜像等文件存放目录
set base_path    /var/spool/apt-mirror
# 架构配置,arm64/amd64,默认的话会下载跟本机相同的架构的源,这里指定arm64的
set defaultarch arm64
# 下载线程数
set nthreads     20
set _tilde 0
# 同步源
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server main restricted universe multiverse

源比较大,这里仅同步4.0.2sp2-server arm64这个源,其他源参考http://archive.kylinos.cn/kylin/KYLIN-ALL,直接添加进mirror.list即可

2.3 同步源

可支持断点续传,随时中断随时继续如下:

apt-mirror

以下为多次同步的过程记录:

root@ubuntu:~# apt-mirror
Downloading 38 index files using 20 threads...
Begin time: Fri Jul  8 03:13:39 2022
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...
End time: Fri Jul  8 03:13:40 2022Processing translation indexes: [T]Downloading 0 translation files using 0 threads...
Begin time: Fri Jul  8 03:13:40 2022
[0]...
End time: Fri Jul  8 03:13:40 2022Processing DEP-11 indexes: [D]Downloading 0 dep11 files using 0 threads...
Begin time: Fri Jul  8 03:13:40 2022
[0]...
End time: Fri Jul  8 03:13:40 2022Processing indexes: [PUse of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3281.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3414.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3489.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3689.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3711.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3827.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3847.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3850.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 3882.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 4386.......Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 38173.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 41169.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 41272.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 41337.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 41340.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 41356.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 41442.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 482.
Use of uninitialized value $lines{"Files:"} in split at /usr/bin/apt-mirror line 829, <STREAM> line 526.
]35.0 GiB will be downloaded into archive.
Downloading 15228 archive files using 20 threads...
Begin time: Fri Jul  8 03:13:53 2022
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...
End time: Sun Jul 10 09:25:56 20220 bytes in 0 files and 0 directories can be freed.
Run /var/spool/apt-mirror/var/clean.sh for this purpose.Running the Post Mirror script ...
(/var/spool/apt-mirror/var/postmirror.sh)Post Mirror script has completed. See above output for any possible errors.root@ubuntu:~#

3. 构建本地源

3.1 基于file模式

编辑/etc/apt/sources.list,我们这里在x86下验证,需要加入架构信息,因为源同步的是arm64的,如下:

deb [arch=arm64] file:///var/spool/apt-mirror/mirror/archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server main restricted universe multiverse

若直接拷贝至arm64服务器构建本地源则sources.list文件中不需要加入arch=arm64,apt-get update出现如下信息即可

root@ubuntu:~# apt-get update
Get:1 file:/var/spool/apt-mirror/mirror/archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server InRelease [49.6 kB]
Get:1 file:/var/spool/apt-mirror/mirror/archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server InRelease [49.6 kB]
Reading package lists... Done

3.2 基于http模式

暂基于Ubuntu 20.04.4 LTS x86_64构建http,安装apache2如下:

apt-get install apache2

由于Apache2的默认网页文件目录位于/var/www/html,因此,可以做个软链接

ln -s /var/spool/apt-mirror/mirror/archive.kylinos.cn/kylin/KYLIN-ALL /var/www/html/KYLIN-ALL

重启apache2服务。
需要安装软件的服务器编辑/etc/apt/sources.list如下:

deb http://x.x.x.x/KYLIN-ALL 4.0.2sp2-server main restricted universe multiverse

x.x.x.x代表http服务器地址。服务器上执行apt-get update就可以用了


4. 问题记录

  • The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY F49EC40DDCE76770
root@ubuntu:/etc/apt# apt-get update
Get:1 http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server-ft2000 InRelease [49.6 kB]
Err:1 http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server-ft2000 InReleaseThe following signatures couldn't be verified because the public key is not available: NO_PUBKEY F49EC40DDCE76770
Reading package lists... Done
W: GPG error: http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server-ft2000 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F49EC40DDCE76770
E: The repository 'http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp2-server-ft2000 InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

解决方案:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F49EC40DDCE76770


5. 参考文献

https://apt-mirror.github.io/
https://manpages.ubuntu.com/manpages/xenial/man1/apt-mirror.1.html

基于apt-mirror同步kylin v4 源及构建本地源相关推荐

  1. 2017/06/23 linux软件管理构建本地源

    构建本地光盘源 1.将本地光盘挂载/mnt下, mount   /dev/cdrom    /mnt 2.在/etc/yum.repos.d/目录下创建自己的源文件,文件名称自定义,必须以repo结尾 ...

  2. Linux中的软件源详解,linux软件管理构建本地源实例详解

    构建本地光盘源 1.将本地光盘挂载/mnt下, mount /dev/cdrom /mnt 2.在/etc/yum.repos.d/目录下创建自己的源文件,文件名称自定义,必须以repo结尾, 3.此 ...

  3. yum源替换成阿里源以及yum源替换成本地源

    目录 1.what is yum? 2.where is yum? 更换国外源为阿里的仓库 更换repo为本地目录源: 更换国外源为网易的仓库: 更换repo为本地目录源 1.what is yum? ...

  4. oracle yum 本地源,Linux YUM本地源配置

    通過rmp安裝Linux包時由於依賴關係原因總是提示需先安裝其依賴的包,創建yum既是先將所有的系統安裝包創建一個庫,然后對所有安裝包進行一個依賴關係分析,那么在下次安裝rpm包時則會自動依據創建的y ...

  5. 基于Unity尝试唇同步/LipSync/OVRLipSync(附Demo及源码)

    在视频创作的时候,这个小破站的审核制度有点气人.所以想着写一个工具,以相对较小的成本,尽可能快的加工视频.算是在唇同步技术上的一个小尝试. 目的和初步的想法 基于Unity3D开发语音输入与3D模型开 ...

  6. 基于VSFTP的本地YUM源及光盘YUM源搭建

    基于VSFTP的本地YUM源及光盘YUM源搭建    一.yum环境的本地源搭建(基于VSFTP):   1)安装vsftp;      ******************************* ...

  7. 基于微信小程序的springboot客运汽车票购票系统源码和论文

    在客运公司工作 7 年之余,对客运管理的难度深有感触.特别是在春运期 间购票难依旧是长途汽车订票的一大难题.长途汽车和火车的订票管理虽然有 差异,但大体上是相同的.长途汽车在售票的过程中需要对旅客的起 ...

  8. mysql复制多行_mysql中的复制方式总结(半同步复制,并行复制,多源复制)

    一.MySQL主从复制(异步复制,默认) Mysql主从复制原理 Mysql的复制原理大致如下: 1.主库记录binlog日志 在每次准备提交事务完成数据更新前,主库将数据更新的事件记录到二进制日志b ...

  9. 基于飞书组织架构和用户信息同步构建本地LDAP服务

    目前飞书社交办公应用成为公司日常沟通办公的协作工具,以及作为各种流程的审批处理系统,HR 也会在飞书上去管理所有员工的状态及组织架构. 随着公司内新部署的业务系统越来越多,例如Jenkins.JIRA ...

最新文章

  1. QuartzCore框架-- iOS中的动画
  2. No Code的世界绝无代码!GitHub CEO:编码的未来根本就没有编码
  3. JDK1.5 新特性
  4. 记录一下两个相机相同处理如何简便进行
  5. proxychains 使用指北
  6. Spring Boot 项目如何做性能监控?
  7. Pycharm的git密码填错了的修改方法
  8. 建立可视化决策平台,“数据化”首当其冲! 1
  9. flex 弹出的titleWindow 隐藏标题栏
  10. Java安装以后为什么打不开java打不开一闪而过如何解决
  11. Burst(突发)信号详解
  12. 如何更改微信小程序二维码物料颜色
  13. php踩过的那些坑(2) strpos引发的血案
  14. 理解modle下的gradle
  15. 使用OpenCV的OpenCL(ocl)模块
  16. java解析word示例(支持docx、doc,wps格式)
  17. Python笔记2_替换式文本加密
  18. 边城科技“区块链+溯源”平台助力坪朗豆腐品牌升级
  19. 【IDM】IDM下载腾讯视频下载广告和分段的问题
  20. 运维之红帽管理员篇-----1. Linux系统简介 、 安装RHEL7系统 、 RHEL7基本操作

热门文章

  1. 如何将img标签水平居中
  2. LeetCode 6077. 巫师的总力量和
  3. http相关十道面试题(含答案)
  4. 加密与解密——软件保护方式
  5. python3.5 beautiful4.4 扣扣国内新闻 爬虫
  6. 苗圩:全国已开通5G基站11.3万个,5G套餐签约用户87万
  7. 34.(leaflet之家)leaflet接入百度影像地图
  8. [转载]文华财经中设置倒置的k线方法
  9. VR多媒体互动系统展馆应用方案
  10. Dictionary 用法