DevToys —— 號稱是開發人員的“瑞士軍刀”,一款適用於開發者的工具集合,包含各種實用的開發小工具。JSON格式化、文本對比、正則表達式...無需網路,離線即可使用! ...
1. 本地環境
RockyLinux: Rocky Linux release 8.8 (Green Obsidian)
python: 3.x.x
公網鏡像:rockylinux鏡像_rockylinux下載地址_rockylinux安裝教程-阿裡巴巴開源鏡像站 (aliyun.com)
2. 說明
Rockylinux 是基於Redhat8 在編譯版本,在redhat8 版本中相比較於redhat7中的本地鏡像倉庫文件除了包的元數據需要創建,還需要創建集合的元數據。以下主要介紹的就是創建集合的元數據的命令。如果不創建將會遇到如下報錯
No available modular metadata for modular package 'perl-AutoLoader-5.74-472.module+el8.8.0+1134+a197a740.noarch', it cannot be installed on the system No available modular metadata for modular package 'perl-B-1.80-472.module+el8.8.0+1134+a197a740.x86_64', it cannot be installed on the system No available modular metadata for modular package 'perl-Carp-1.50-439.module+el8.6.0+879+823e3012.noarch', it cannot be installed on the system No available modular metadata for modular package 'perl-Class-Struct-0.66-472.module+el8.8.0+1134+a197a740.noarch', it cannot be installed on the system No available modular metadata for modular package 'perl-Data-Dumper-2.174-440.module+el8.6.0+879+823e3012.x86_64', it cannot be installed on the system No available modular metadata for modular package 'perl-Digest-1.20-1.module+el8.6.0+879+823e3012.noarch', it cannot be installed on the system No available modular metadata for modular package 'perl-Digest-MD5-2.58-1.module+el8.6.0+879+823e3012.x86_64', it cannot be installed on the system No available modular metadata for modular package 'perl-DynaLoader-1.47-472.module+el8.8.0+1134+a197a740.x86_64', it cannot be installed on the system No available modular metadata for modular package 'perl-Encode-4:3.08-461.module+el8.6.0+879+823e3012.x86_64', it cannot be installed on the system
3. 從0開始搭建本地鏡像
3.1 搭建本地nginx服務,提供目錄索引,並設置root為 /data (搭建過程自行搜索)
3.2 本地伺服器yum源更改預設的為阿裡雲鏡像
sed -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \ -i.bak \ /etc/yum.repos.d/Rocky-*.repo dnf makecache
3.3 搭建Rockyliunx 本地鏡像倉庫 baseos
創建目錄
mkdir /data/rocky/8/
3.4 使用reposync同步鏡像數據到本地
reposync --repoid=baseos -p /data/rocky/8/
3.5 進入目錄,執行createrepo_c 生成包的元數據信息
cd /data/rocky/8/base createrepo_c .
3.6 安裝集合元數據生成命令軟體包modulemd-tools,生成modules.yaml 文件,之後再寫入到 repodate/目錄中
yum install -y modulemd-tools cd /data/rocky/8/baseos repo2module -s stable ./ modules.yaml createrepo . modifyrepo_c --mdtype=modules modules.yaml repodata/
3.7 編寫 rocky.repo本地文件
[root@rocky8U9-template yum.repos.d]# cat rocky.repo [baseos] name=vcredit rocky linux base - baseurl=http://x.x.x.x/rocky/8/baseos gpgcheck=0 [appstream] name=vcredit rocky linux appstream baseurl=http://x.x.x.x/rocky/8/appstream gpgcheck=0 [zabbix] name=vcredit rocky linux zabbix baseurl=http://x.x.x.x/zabbix/8/ gpgcheck=0
3.8 在內網機器下載repo文件,同步完成即可下載。
ps:appstream本地倉庫創建命令如下:
reposync --repoid=appstream -p /data/rocky/8/ cd /data/rocky/8/appstream repo2module -s stable ./ modules.yaml createrepo . modifyrepo_c --mdtype=modules modules.yaml repodata/