如何自訂 repositories ?

首先先弄好一台 web 伺服器,然後安裝 createrepo 套件

# dnf install createrepo
Last metadata expiration check: 2:46:04 ago on Thu 30 Jun 2022 03:15:05 PM CST.
Package createrepo_c-0.17.2-3.el8.x86_64 is already installed.
Dependencies resolved.
===============================================================================================================================
 Package                             Architecture             Version                        Repository                   Size
===============================================================================================================================
Upgrading:
 createrepo_c                        x86_64                   0.17.7-5.el8                   appstream                    88 k
 createrepo_c-libs                   x86_64                   0.17.7-5.el8                   appstream                   115 k

Transaction Summary
===============================================================================================================================
Upgrade  2 Packages

Total download size: 204 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): createrepo_c-0.17.7-5.el8.x86_64.rpm                                                     28 kB/s |  88 kB     00:03
(2/2): createrepo_c-libs-0.17.7-5.el8.x86_64.rpm                                                33 kB/s | 115 kB     00:03
-------------------------------------------------------------------------------------------------------------------------------
Total                                                                                           41 kB/s | 204 kB     00:05
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                       1/1
  Upgrading        : createrepo_c-libs-0.17.7-5.el8.x86_64                                                                 1/4
  Upgrading        : createrepo_c-0.17.7-5.el8.x86_64                                                                      2/4
  Cleanup          : createrepo_c-0.17.2-3.el8.x86_64                                                                      3/4
  Cleanup          : createrepo_c-libs-0.17.2-3.el8.x86_64                                                                 4/4
  Running scriptlet: createrepo_c-libs-0.17.2-3.el8.x86_64                                                                 4/4
  Verifying        : createrepo_c-0.17.7-5.el8.x86_64                                                                      1/4
  Verifying        : createrepo_c-0.17.2-3.el8.x86_64                                                                      2/4
  Verifying        : createrepo_c-libs-0.17.7-5.el8.x86_64                                                                 3/4
  Verifying        : createrepo_c-libs-0.17.2-3.el8.x86_64                                                                 4/4

Upgraded:
  createrepo_c-0.17.7-5.el8.x86_64                            createrepo_c-libs-0.17.7-5.el8.x86_64

Complete!

然後把建立好的目錄直接用下列指令建立 repositories

# createrepo /www/html/public/lustre/lustre-2.15.0-ib/MOFED-5.5-1.0.3.2/el8.0.2/client
# ls -l repodata/
total 160
-rw-r--r-- 1 root root 69873 Jun 30 15:29 00707b264fd0a21d7b461b0edbf9a0831018de072b513cdc1e80a251af70dc67-primary.sqlite.bz2
-rw-r--r-- 1 root root 21609 Jun 30 15:29 07f2a23420eb0e3f94ab2306d358caf5f1e140d945e33b79bca838094a263247-filelists.sqlite.bz2
-rw-r--r-- 1 root root 14562 Jun 30 15:29 27728876d19f719f175d26ce0809f90f573d07e0eeaf2eb88200fd791da52dc4-filelists.xml.gz
-rw-r--r-- 1 root root   767 Jun 30 15:29 64e492489e4480ec86abf5a49be1eb6c9446aa5d0e0a6cd0e43864efd7503f60-other.xml.gz
-rw-r--r-- 1 root root 35208 Jun 30 15:29 9c173120bd3efcb4cbb5210322269256bd4d7e341e0c81c3ef406dc6292305b4-primary.xml.gz
-rw-r--r-- 1 root root  1357 Jun 30 15:29 eefda101bc50d099588828a4ffa2095d543a8fb1bc9b048d35326939d89e35c0-other.sqlite.bz2
-rw-r--r-- 1 root root  2988 Jun 30 15:29 repomd.xml

如果日後有要更新就用 – -update 參數

# createrepo --update /www/html/public/lustre/lustre-2.15.0-ib/MOFED-5.5-1.0.3.2/el8.0.2/client

然後編輯你要的 .repo 檔案

# vi /etc/yum.repos.d/lustre.repo
[lustre-client]
name=lustre-client
baseurl=https://liho.tw/public/lustre/lustre-2.15.0-ib/MOFED-5.5-1.0.3.2/el8.0.2/client
# exclude=*debuginfo*
gpgcheck=0