RockyLinux8.8 本地镜像仓库搭建过程

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/

 

热门相关:朔明   顺明   惹火甜妻:老公大人,宠上瘾!   官策   官策