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

由于外网服务器是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/

相关推荐
Rockbean1 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪1 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩1 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
崔小汤呀1 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应1 天前
vi编辑器使用
linux·后端·操作系统
何中应1 天前
Linux进程无法被kill
linux·后端·操作系统
何中应1 天前
rm-rf /命令操作介绍
linux·后端·操作系统
何中应1 天前
Linux常用命令
linux·操作系统
葛立国1 天前
从 / 和 /dev 说起:Linux 文件系统与挂载点一文理清
linux
海天鹰2 天前
【免费】PHP主机=域名+解析+主机
服务器