外网同步麒麟源到内网搭建,包含桌面和服务器版本

由于外网服务器是centos7系统,需要拉取麒麟系统源,先通过在centos7服务器上起docker,然后再安装Debian镜像,来拉取:

1.在 CentOS 主机上创建目录,用于挂载到 Debian 容器内,下载的麒麟源文件会直接保存在 CentOS 主机上(避免容器删除后文件丢失):

创建存储目录(建议选大空间分区,如 /data,需确保 ≥50GB 空闲)

sudo mkdir -p /data/kylinos-mirror

赋予权限(避免容器内写入权限不足)

sudo chmod 777 /data/kylinos-mirror

2. 拉取 Debian 镜像并启动容器

选择稳定版 Debian(如 Debian 11,与麒麟源兼容性好),并挂载本地目录到容器内:

拉取 Debian 11 镜像(若需其他版本,替换为 debian:10 等)

sudo docker pull debian:11

启动容器(核心是 -v 挂载目录,--privileged 提升权限)

sudo docker run -itd \

--name kylin-mirror-container \

--privileged=true \

-v /data/kylinos-mirror:/mnt/kylinos-mirror \ # 主机目录:容器内目录

debian:11 /bin/bash

这里docker需要调整配置,不然无法拉取镜像

root@localhost kylinos-mirror\]# vim /etc/docker/daemon.json { "registry-mirrors": \["https://docker.m.daocloud.io", "https://docker.1panel.live", "https://hub.rat.dev"

}

3. 进入 Debian 容器

bash

运行

sudo docker exec -it kylin-mirror-container /bin/bash

4. 容器内配置 apt 源并安装 apt-mirror(可以不做调整,直接更新)

首先更新容器内的 apt 源,再安装 apt-mirror:

bash

运行

替换 Debian 源为国内镜像(加速下载)

echo "deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib

deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib

deb http://mirrors.aliyun.com/debian-security/ bullseye-security main

deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main

deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib

deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" > /etc/apt/sources.list

# 更新 apt 缓存并安装 apt-mirror

apt update && apt install -y apt-mirror

5. 配置 apt-mirror(核心,路径,版本,下载线程,默认会下载和系统相同架构的,不会下另外架构,后面增加arm架构的)

编辑 /etc/apt/mirror.list,重点是将存储路径指向挂载的 /mnt/kylinos-mirror(确保文件保存到 CentOS 主机):

set base_path /mnt/kylinos-mirror

set temp_path $base_path/tmp

set mirror_path $base_path/mirror

set skel_path $base_path/skel

set var_path $base_path/var

#添加arm版本

deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.0 main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1 main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2107-updates main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2203-updates main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2203-hwe-updates main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp3-desktop main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp3-server main restricted universe multiverse

deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 10.0 main restricted universe multiverse ::nosrc
deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1 main restricted universe multiverse ::nosrc
deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2107-updates main restricted universe multiverse ::nosrc
deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2203-updates main restricted universe multiverse ::nosrc
deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2203-hwe-updates main restricted universe multiverse ::nosrc
deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp3-desktop main restricted universe multiverse ::nosrc
deb [arch=arm64] http://archive.kylinos.cn/kylin/KYLIN-ALL 4.0.2sp3-server main restricted universe multiverse ::nosrc

set nthreads 25 #25个线程下载

set chunk_size 1000 #下载块kb

set _tilde 0

6. 启动同步下载(图上版本下载完大概amd版本-196G)

在容器内执行 apt-mirror,建议后台运行(避免终端断开中断):

bash

运行

后台运行并输出日志(日志文件保存在 CentOS 主机的 /data/kylinos-mirror/var 目录)

nohup apt-mirror > /mnt/kylinos-mirror/var/mirror.log 2>&1 &

7.下载完将下面目录打包拷入内网

/data/kylinos-mirror/mirror/archive.kylinos.cn/kylin/KYLIN-ALL

8.后续内网参考centos7搭建即可

9.附上外网麒麟所有版本源地址:https://archive.kylinos.cn/kylin/KYLIN-ALL/

相关推荐
2401_892070981 天前
【Linux C++ 日志系统实战】LogFile 日志文件管理核心:滚动策略、线程安全与方法全解析
linux·c++·日志系统·日志滚动
雪可问春风1 天前
docker环境部署
运维·docker·容器
lwx9148521 天前
Linux-Shell算术运算
linux·运维·服务器
翻斗包菜1 天前
PostgreSQL 日常维护完全指南:从基础操作到高级运维
运维·数据库·postgresql
somi71 天前
ARM-驱动-02-Linux 内核开发环境搭建与编译
linux·运维·arm开发
双份浓缩馥芮白1 天前
【Docker】Linux 迁移 docker 目录(软链接)
linux·docker
海的透彻1 天前
nginx启动进程对文件的权限掌控
运维·chrome·nginx
黄昏晓x1 天前
Linux ---- UDP和TCP
linux·tcp/ip·udp
路溪非溪1 天前
Linux驱动开发中的常用接口总结(一)
linux·运维·驱动开发
此刻觐神1 天前
IMX6ULL开发板学习-01(Linux文件目录和目录相关命令)
linux·服务器·学习