基于repo同步kylin v10 源及构建本地源

1. 需求和环境

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

客户端:X86笔记本
客户端OS版本:Kylin-Server-10-SP1-Release


2. 同步源到本地

2.1 安装createrepo和reposync等

使用reposync的方式同步yum源下载缓存rpm包到本地机,使用createrepo命令制作一个本地内网yum仓库。。安装软件包如下:

yum install createrepo  reposync  yum-utils httpd 

2.2 配置repo

编辑文件vim /etc/yum.repos.d/kylin.repo

[V10SP1.1-base-x86_64]
name = V10SP1.1-base-x86_64
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/x86_64
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

[V10SP1.1-updates-x86_64]
name = V10SP1.1-updates-x86_64
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

[V10SP1.1-addons-x86_64]
name = V10SP1.1-addons-x86_64
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/x86_64
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1



[V10SP1.1-base-aarch64]
name = V10SP1.1-base-aarch64
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/aarch64
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

[V10SP1.1-updates-aarch64]
name = V10SP1.1-updates-aarch64
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

[V10SP1.1-addons-aarch64]
name = V10SP1.1-addons-aarch64
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/aarch64
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

版本比较多,根据需要进行同步,源地址为:https://update.cs2c.com.cn和http://archive2.kylinos.cn/rpm,这里主要同步V10SP1.1 x86_64和aarch64架构的,添加进kylin.repo即可

2.3 验证源

使用yum repolist验证kylin.repo文件是否生效

repo id                                                        repo name
V10SP1.1-addons-aarch64                                        V10SP1.1-addons-aarch64
V10SP1.1-addons-x86_64                                         V10SP1.1-addons-x86_64
V10SP1.1-base-aarch64                                          V10SP1.1-base-aarch64
V10SP1.1-base-x86_64                                           V10SP1.1-base-x86_64
V10SP1.1-updates-aarch64                                       V10SP1.1-updates-aarch64
V10SP1.1-updates-x86_64                                        V10SP1.1-updates-x86_64

2.4 同步源

创建目录,保证空间足够

mkdir -p /yum/update.cs2c.com.cn/NS/V10/

执行同步

reposync -n --repoid=V10SP1.1-base-x86_64 --repoid=V10SP1.1-updates-x86_64 --repoid=V10SP1.1-addons-x86_64 --repoid=V10SP1.1-base-aarch64 --repoid=V10SP1.1-updates-aarch64 --repoid=V10SP1.1-addons-aarch64 -p /yum/update.cs2c.com.cn/NS/V10/

根据源环境路径更改路径,保持与官方源路径一致

cd /yum/update.cs2c.com.cn/NS/V10
mkdir -p V10SP1.1/os/adv/lic/base/x86_64 V10SP1.1/os/adv/lic/updates/x86_64 V10SP1.1/os/adv/lic/addons/x86_64 V10SP1.1/os/adv/lic/base/aarch64 V10SP1.1/os/adv/lic/updates/aarch64 V10SP1.1/os/adv/lic/addons/aarch64
mv V10SP1.1-base-x86_64/* V10SP1.1/os/adv/lic/base/x86_64/
mv V10SP1.1-updates-x86_64/* V10SP1.1/os/adv/lic/updates/x86_64/
mv V10SP1.1-addons-x86_64/* V10SP1.1/os/adv/lic/addons/x86_64/

mv V10SP1.1-base-aarch64/* V10SP1.1/os/adv/lic/base/aarch64/
mv V10SP1.1-updates-aarch64/* V10SP1.1/os/adv/lic/updates/aarch64/
mv V10SP1.1-addons-aarch64/* V10SP1.1/os/adv/lic/addons/aarch64/

rm -rf V10SP1.1-base-aarch64 V10SP1.1-updates-aarch64 V10SP1.1-addons-aarch64

3. 构建本地源

3.1 创建索引

createrepo -po /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/x86_64 /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/x86_64
createrepo -po /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64 /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64
createrepo -po /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/x86_64 /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/x86_64

createrepo -po /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/aarch64 /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/aarch64
createrepo -po /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64 /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/aarch64
createrepo -po /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/aarch64 /yum/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/aarch64

3.2 配置apache

  • 设置apache 根目录设置为/yum/,修改/etc/httpd/conf/httpd.conf,如下
DocumentRoot "/yum/"
<Directory "/yum/">
  Options Indexes FollowSymLinks
  Options Indexes
  AllowOverride None
  Order allow,deny
  IndexOptions Charset=UTF-8
  Allow from all
  Require all granted
</Directory>
  • 删除welcome配置,达到访问服务器地址直接访问站点根目录
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak
  • 关闭防火墙和selinux
systemctl stop firewalld.service
systemctl disable firewalld.service

编辑文件/etc/selinux/config将SELINUX=disabled,同时执行

setenforce 0
  • 开启httpd服务
systemctl restart httpd
systemctl enable httpd

3.3 浏览器访问

在这里插入图片描述
点击进去,可以访问到相应版本的源,通过浏览器可以发现保持了与官方的源一致的路径

3.4 客户端配置使用本地源

vim /etc/yum.repos.d/kylin.repo

###Kylin Linux Advanced Server 10 - os repo###

[ks10-adv-os]
name = Kylin Linux Advanced Server 10 - Os
baseurl = http://172.25.0.166/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/base/$basearch/
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

[ks10-adv-updates]
name = Kylin Linux Advanced Server 10 - Updates
baseurl = http://172.25.0.166/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/$basearch/
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

[ks10-adv-addons]
name = Kylin Linux Advanced Server 10 - Addons
baseurl = http://172.25.0.166/update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/addons/$basearch/
gpgcheck = 1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin
enabled = 1

执行yum update

Kylin Linux Advanced Server 10 - Os                                                           101 kB/s | 257  B     00:00
Kylin Linux Advanced Server 10 - Updates                                                       77 kB/s | 257  B     00:00
Kylin Linux Advanced Server 10 - Addons                                                       126 kB/s | 257  B     00:00
Dependencies resolved.
Nothing to do.
Complete!

接下来就可以直接安装软件包了


4. 参考文献

https://www.cnblogs.com/vilenx/p/12533361.html
https://blog.csdn.net/yuanfangPOET/article/details/107825360
https://blog.csdn.net/qq_37696855/article/details/118115012
https://developer.aliyun.com/article/1099035
https://cloud.tencent.com/developer/article/1362986

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值