同步外网repo到本地

|1|repo服务器上查看repolist|
|2|repo服务器上拉取update源|

 update]# reposync --repoid=update -p /var/www/html/openeuler/openEuler-22.03-LTS/update/
update                                                                    32 kB/s | 3.5 kB     00:00
(1/5420): GraphicsMagick-c++-1.3.30-9.oe2203.x86_64.rpm       385 kB/s | 117 kB     00:00
(2/5420): GraphicsMagick-c++-devel-1.3.30-9.oe2203.x86_64.rpm                                     381 kB/s |  53 kB     00:00
(3/5420): GraphicsMagick-1.3.30-9.oe2203.x86_64.rpm           1.9 MB/s | 1.3 MB     00:00
……………………………………………………………………………………中间部分省略……………………………………………………………………….
(5416/5420): zlib-debugsource-1.2.11-22.oe2203.x86_64.rpm     3.3 MB/s | 157 kB     00:00
(5417/5420): zlib-help-1.2.11-20.oe2203.noarch.rpm             238 kB/s | 9.8 kB     00:00
(5418/5420): zlib-devel-1.2.11-20.oe2203.x86_64.rpm            1.7 MB/s |  90 kB     00:00
(5419/5420): zlib-devel-1.2.11-22.oe2203.x86_64.rpm            1.8 MB/s |  90 kB     00:00
(5420/5420): zlib-help-1.2.11-22.oe2203.noarch.rpm             260 kB/s |  10 kB     00:00

3repo服务器上创建update源

 update]# mv update x86_64
 update]# createrepo -p --workers=10 /var/www/html/openeuler/openEuler-22.03-LTS/update/x86_64/
Directory walk started
Directory walk done - 5420 packages
Temporary output repo path: /var/www/html/openeuler/openEuler-22.03-LTS/update/x86_64/.repodata/
Preparing sqlite DBs
Pool started (with 10 workers)
Pool finished

4 创建EPOL源和everything源

1)EPOL源
 update]# reposync --repoid=EPOL -p /var/www/html/openeuler/openEuler-22.03-LTS/EPOL/main/
EPOL                                                                      43 kB/s | 3.0 kB     00:00
(1/2134): A-FOT-v1.0-0.oe2203.x86_64.rpm                         167 kB/s |  17 kB     00:00
(2/2134): Thunar-1.8.17-2.oe2203.x86_64.rpm                     4.0 MB/s | 1.5 MB     00:00
……………………………………………………………………………………中间部分省略……………………………………………………………………….
(2134/2134): xfce4-appfinder-4.16.0-1.oe2203.x86_64.rpm        27 kB/s | 272 kB     00:10
 update]# cd ../EPOL/main
 main]# mv EPOL x86_64
 main]# cd x86_64/
 x86_64]# createrepo -p --workers=10 /var/www/html/openeuler/openEuler-22.03-LTS/EPOL/main/x86_64/
Directory walk started
Directory walk done - 2134 packages
Temporary output repo path: /var/www/html/openeuler/openEuler-22.03-LTS/EPOL/main/x86_64/.repodata/
Preparing sqlite DBs
Pool started (with 10 workers)
Pool finished
2)everything源

x86_64]# cd …/…/…/everything/
everything]# reposync --repoid=everything -p /var/www/html/openeuler/openEuler-22.03-LTS/everything/
everything 54 kB/s | 3.8 kB 00:00
(1/16818): 389-ds-base-help-1.4.3.20-1.oe2203.x86_64.rpm 1.0 MB/s | 168 kB 00:00
(2/16818): 389-ds-base-devel-1.4.3.20-1.oe2203.x86_64.rpm 587 kB/s | 100 kB 00:00
(3/16818): 389-ds-base-snmp-1.4.3.20-1.oe2203.x86_64.rpm 874 kB/s | 34 kB 00:00
……………………………………………………………………………………中间部分省略……………………………………………………………………….
(16817/16818): zziplib-help-0.13.71-3.oe2203.noarch.rpm 1.6 MB/s | 65 kB 00:00
(16818/16818): zenity-3.41.0-1.oe2203.x86_64.rpm 1.2 MB/s | 3.1 MB 00:02
[root@node21 everything]# mv everything x86_64
[root@node21 x86_64]# createrepo -p --workers=10 /var/www/html/openeuler/openEuler-22.03-LTS/everything/x86_64/
Directory walk started
Directory walk done - 16818 packages
Temporary output repo path: /var/www/html/openeuler/openEuler-22.03-LTS/everything/x86_64/.repodata/
Preparing sqlite DBs
Pool started (with 10 workers)
Pool finished

5	终端主机上配置本地repo源测试
 yum.repos.d]# cat openEuler.repo
[everything]
name=everything
baseurl=http://192.168.137.21/openeuler/openEuler-22.03-LTS/everything/x86_64/
enabled=1
gpgcheck=0
 
[EPOL]
name=EPOL
baseurl=http://192.168.137.21/openeuler/openEuler-22.03-LTS/EPOL/main/x86_64/
enabled=1
gpgcheck=0
 
[update]
name=update
baseurl=http://192.168.137.21/openeuler/openEuler-22.03-LTS/update/x86_64/
enabled=1
gpgcheck=0

进行测试

 yum.repos.d]# yum clean all
0 files removed
 yum.repos.d]# yum makecache
everything                                                             241 MB/s |  16 MB     00:00
EPOL                                                                      95 MB/s | 2.6 MB     00:00
update                                                                  324 MB/s |  36 MB     00:00
Metadata cache created.

此时可以看到本地的repo源已经可以使用了。
6 新增rpm包到EPOL仓
此处我们上传wordplay的rpm包到repo服务器的EPOL仓:

 x86_64]# cd /var/www/html/openeuler/openEuler-22.03-LTS/EPOL/main/x86_64/Packages/

Packages]# ls wordplay-7.22-5.x86_64.rpm

wordplay-7.22-5.x86_64.rpm

7 终端主机查询repo源里是否有wordplay包

# yum search wordplay
Last metadata expiration check: 0:17:55 ago on Tue 04 Apr 2023 08:20:17 AM CST.
No matches found.
此时可以看到:repo源中没有wordplay这个包。
8	repo服务器上面更新repo源
 Packages]# createrepo -p --workers=10 /var/www/html/openeuler/openEuler-22.03-LTS/EPOL/main/x86_64/
Directory walk started
Directory walk done - 2135 packages
Temporary output repo path: /var/www/html/openeuler/openEuler-22.03-LTS/EPOL/main/x86_64/.repodata/
Preparing sqlite DBs
Pool started (with 10 workers)
Pool finished

9 终端主机上面查询repo源是否有wordplay包

# yum clean all
15 files removed
# yum search wordplay
everything                                                              302 MB/s |  16 MB     00:00
EPOL                                                                     147 MB/s | 2.6 MB     00:00
update                                                                   333 MB/s |  36 MB     00:00
Last metadata expiration check: 0:00:01 ago on Tue 04 Apr 2023 08:42:52 AM CST.
============================ Name & Summary Matched: wordplay =========================
wordplay.x86_64 : 'Wordplay generates anagrams of words or phrases. For example, Debian GNU/Linux = laud benign unix, nubian lug index, dang
                : nubile unix, or I debug in lax nun.'

此时发现repo源里面已经有wordplay这个包了。
10 终端主机上面查询repo源是否有stress包

# yum search stress
Last metadata expiration check: 0:25:57 ago on Thu 06 Apr 2023 07:56:23 PM CST.
No matches found.

此时可以看到:repo源中是没有stress包的,下面我们将通过源码包来构建rpm包,然后拷贝到repo服务上。

4 Likes

经典好贴,必赞!