正文
背景
昨天晚上进行了在线升级银河麒麟V10SP2的audit和mate-indicator的rpm包
今天想了下,如果机器无法上网. 必须得在公司内部搭建一套离线的rpm源进行处理
想了下还是使用reposync以及createrepo+nginx发布比较好一些.
昨天晚上写完之后就可以使用reposync进行了下载rpm包的动作.
这里简单总结说明一下.
reporsync的使用
yum -y install yum-utils createrepo plugin-priorities
在能够上网的机器上面创建一套 yum源
cat > /etc/yum.repos.d/update.repo << EOF
[KYLIN10SP2UPDATE]
name = KYLIN10SP2UPDATE
baseurl = https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/updates/\$basearch/
gpgcheck = 0
enabled = 1
EOF
然后创建本地目录
mkdir /kylinrepoaarch64
可以从网上下载对应的rpm包
注意过程非常漫长,我这边耗时大约4-5个小时,下载了12-15G的文件.
需要注意如果是x86也可以进行创建.
reporsync --repoid=KYLIN10SP2UPDATE -p /kylin/updates/aarch64
注意如果是进行update 好像可以使用 -n 的命令
本次主要是进行一次性的处理, 暂时不考虑升级.
会将rpm包都下载到 /kylin/updates/aarch64/Packages 目录下面.
createrepo的处理
可以在目录下执行处理.比如:
cd /kylin/updates/aarch64
createrepo -v Packages/ -o repodata
需要注意的是 repodata 必须有这个目录
aarch64 下面必须有对应的rpm包.
使用完之后 建议进行相关的处理. 可能需要将rpm包
从 Packages 里面的内容 挪到上一层的 aarch64目录中
不然下载可能会下载不到.
Nginx暴露服务
nginx的配置文件
worker_processes 1;
error_log /data/nginx/logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
error_log /data/nginx/logs/error.log ;
sendfile on;
keepalive_timeout 65;
server_tokens off ;
gzip on;
server {
listen 80;
server_name localhost;
location / {
autoindex on;
root /kylin/ ;
}
}
}
不同机器验证
创建一个简单的内网使用的yum源
cat > /etc/yum.repos.d/update.repo << EOF
[KYLIN10SP2UPDATE]
name = KYLIN10SP2UPDATE
baseurl = http://10.110.80.1/updates/\$basearch/
gpgcheck = 0
enabled = 1
EOF
yum clean all
yum makecache
yum install audit* mate-indicator* -y
验证结果
Last metadata expiration check: 0:00:33 ago on 2022年12月27日 星期二 08时43分20秒.
Package audit-3.0-5.se.06.ky10.x86_64 is already installed.
Package audit-help-3.0-5.se.06.ky10.noarch is already installed.
Package audit-libs-3.0-5.se.06.ky10.x86_64 is already installed.
Package mate-indicators-20150918kord0ukui58-10.p03.ky10.x86_64 is already installed.
Dependencies resolved.
==========================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==========================================================================================================================================================================================================================================
Installing:
audit-devel x86_64 3.0-5.se.12.ky10 ks10-adv-updates 135 k
Upgrading:
audit x86_64 3.0-5.se.12.ky10 ks10-adv-updates 171 k
audit-help noarch 3.0-5.se.12.ky10 ks10-adv-updates 123 k
audit-libs x86_64 3.0-5.se.12.ky10 ks10-adv-updates 99 k
mate-indicators x86_64 20150918kord0ukui58-10.p07.ky10 ks10-adv-updates 217 k
python2-audit x86_64 3.0-5.se.12.ky10 ks10-adv-updates 71 k
python3-audit x86_64 3.0-5.se.12.ky10 ks10-adv-updates 71 k
Transaction Summary
==========================================================================================================================================================================================================================================
Install 1 Package
Upgrade 6 Packages
Total download size: 886 k
Downloading Packages:
(1/7): audit-devel-3.0-5.se.12.ky10.x86_64.rpm 383 kB/s | 135 kB 00:00
(2/7): audit-help-3.0-5.se.12.ky10.noarch.rpm 260 kB/s | 123 kB 00:00
(3/7): audit-3.0-5.se.12.ky10.x86_64.rpm 347 kB/s | 171 kB 00:00
(4/7): audit-libs-3.0-5.se.12.ky10.x86_64.rpm 316 kB/s | 99 kB 00:00
(5/7): python2-audit-3.0-5.se.12.ky10.x86_64.rpm 342 kB/s | 71 kB 00:00
(6/7): mate-indicators-20150918kord0ukui58-10.p07.ky10.x86_64.rpm 534 kB/s | 217 kB 00:00
(7/7): python3-audit-3.0-5.se.12.ky10.x86_64.rpm 327 kB/s | 71 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 998 kB/s | 886 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Upgrading : audit-libs-3.0-5.se.12.ky10.x86_64 1/13
Upgrading : audit-3.0-5.se.12.ky10.x86_64 2/13
Running scriptlet: audit-3.0-5.se.12.ky10.x86_64 2/13
Installing : audit-devel-3.0-5.se.12.ky10.x86_64 3/13
Upgrading : python2-audit-3.0-5.se.12.ky10.x86_64 4/13
Upgrading : python3-audit-3.0-5.se.12.ky10.x86_64 5/13
Upgrading : mate-indicators-20150918kord0ukui58-10.p07.ky10.x86_64 6/13
Running scriptlet: mate-indicators-20150918kord0ukui58-10.p07.ky10.x86_64