RHEL8 - Create Local HTTP Yum/DNF Repository

 A.   Yum Server

1.      Install package httpd, createrepo

2.      Mount iso image for rhel8, edb4rhel8

[root@yum-server conf.d]# df –h

/dev/loop1              13G   13G     0 100% /edb

/dev/loop2              14G   14G     0 100% /rhel8

3.      Copy all files from mount disks to repository

[root@yum-server ~]# cp -r /rhel8/* /source/www/html/repo

[root@yum-server ~]# cp -r /edb/* /source/www/html/repo/EDB

4.      Create Repository Metadata

[root@yum-server ~]# createrepo /source/www/html/repo/BaseOS

[root@yum-server ~]# createrepo /source/www/html/repo/AppStream

[root@yum-server ~]# createrepo /source/www/html/repo/EDB

 

[root@yum-server ~]# ls -l /source/www/html/repo

total 400

dr-xr-xr-x 4 root root   4096 Jun  5 09:14 AppStream

dr-xr-xr-x 4 root root   4096 Jun  5 09:13 BaseOS

drwxr-xr-x 4 root root 331776 Jun  5 09:24 EDB

dr-xr-xr-x 3 root root   4096 Jun  5 08:59 EFI

-r--r--r-- 1 root root   8154 Jun  5 09:05 EULA

-r--r--r-- 1 root root   1455 Jun  5 09:05 extra_files.json

-r--r--r-- 1 root root  18092 Jun  5 09:05 GPL

dr-xr-xr-x 3 root root   4096 Jun  5 09:05 images

dr-xr-xr-x 2 root root   4096 Jun  5 09:05 isolinux

-r--r--r-- 1 root root    104 Jun  5 09:05 media.repo

drwxr-xr-x 2 root root   4096 Jun  5 09:30 repodata

-r--r--r-- 1 root root   1669 Jun  5 09:05 RPM-GPG-KEY-redhat-beta

-r--r--r-- 1 root root   5135 Jun  5 09:05 RPM-GPG-KEY-redhat-release

-r--r--r-- 1 root root   1796 Jun  5 09:05 TRANS.TBL

5.      Configuring Local Repository

[root@yum-server ~]# ls -l /etc/yum.repos.d/

-rw-r--r-- 1 root root  504 Jun  5 09:23 rhel8.repo

-r--r--r-- 1 root root 5135 Jun  4 13:40 RPM-GPG-KEY-RHEL8 (copy from RPM-GPG-KEY-redhat-release and rename)

 

[root@yum-server ~]# vi /etc/yum.repos.d/rhel8.repo

[rhel8u10_baseos]

name=Local - Red Hat Enterprise Linux 8.10 - BaseOS

baseurl=file:///source/www/html/repo/BaseOS/

gpgkey=file:///etc/yum.repos.d/RPM-GPG-KEY-RHEL8

gpgcheck=1

enabled=1

 

[rhel8u10_appstream]

name=Local - Red Hat Enterprise Linux 8.10 - Appstream

baseurl=file:///source/www/html/repo/AppStream/

gpgkey=file:///etc/yum.repos.d/RPM-GPG-KEY-RHEL8

gpgcheck=1

enabled=1

 

[edb4rhel8]

name=Local - Enterprise Database for RHEL8/OL8

baseurl=file:///source/www/html/repo/EDB/

gpgcheck=0

enabled=1 

6.      Testing Local Repository

[root@yum-server ~]# dnf clean all

[root@yum-server ~]# dnf repolist -v

Repo-id            : edb4rhel8

Repo-name          : Local - Enterprise Database for RHEL8/OL8

Repo-revision      : 1717554297

Repo-updated       : Wed 05 Jun 2024 09:24:57 AM +07

Repo-pkgs          : 4,291

Repo-available-pkgs: 3,624

Repo-size          : 13 G

Repo-baseurl       : file:///source/www/html/repo/EDB/

Repo-expire        : 172,800 second(s) (last: Wed 05 Jun 2024 10:16:38 AM +07)

Repo-filename      : /etc/yum.repos.d/rhel8.repo

 

Repo-id            : rhel8u10_appstream

Repo-name          : Local - Red Hat Enterprise Linux 8.10 - Appstream

Repo-revision      : 1717553667

Repo-updated       : Wed 05 Jun 2024 09:14:27 AM +07

Repo-pkgs          : 7,117

Repo-available-pkgs: 5,672

Repo-size          : 11 G

Repo-baseurl       : file:///source/www/html/repo/AppStream/

Repo-expire        : 172,800 second(s) (last: Wed 05 Jun 2024 10:16:38 AM +07)

Repo-filename      : /etc/yum.repos.d/rhel8.repo

 

Repo-id            : rhel8u10_baseos

Repo-name          : Local - Red Hat Enterprise Linux 8.10 - BaseOS

Repo-revision      : 1717553581

Repo-updated       : Wed 05 Jun 2024 09:13:01 AM +07

Repo-pkgs          : 1,742

Repo-available-pkgs: 1,737

Repo-size          : 1.5 G

Repo-baseurl       : file:///source/www/html/repo/BaseOS/

Repo-expire        : 172,800 second(s) (last: Wed 05 Jun 2024 10:16:38 AM +07)

Repo-filename      : /etc/yum.repos.d/rhel8.repo

Total packages: 13,150

7.      Configuring HTTPD

-        Start httpd

o   [root@yum-server ~]# systemctl start httpd.service

o   [root@yum-server ~]# systemctl enable httpd.service

-        Edit /etc/httpd/conf/httpd.conf

o   ServerName yum-server.taolaoxibup.com:80

o   Directory "/source/www/html/repo"

o   DocumentRoot "/source/www/html/repo"

-        Restart httpd

o   [root@yum-server ~]# systemctl restart httpd.service

 

 

B.   Client

1.      Setup Local Yum Repository

[root@xxx-app ~]# vi /etc/yum.repos.d/edb4rhel8.repo

[rhel8u10_baseos]

name=Local - Red Hat Enterprise Linux 8.10 - BaseOS

baseurl=http://yum-server.taolaoxibup.com/BaseOS

gpgcheck=0

enabled=1

 

[rhel8u10_appstream]

name=Local - Red Hat Enterprise Linux 8.10 - Appstream

baseurl=http://yum-server.taolaoxibup.com/AppStream/

gpgcheck=0

enabled=1

 

[edb4rhel8]

name=Local - Enterprise Database for RHEL8/OL8

baseurl=http://yum-server.taolaoxibup.com/EDB/

gpgcheck=0

enabled=1

 

2.      Verify the configuration

[root@xxx-app ~]# dnf clean all

[root@xxx-app ~]# dnf repolist -v

Repo-id            : edb4rhel8

Repo-name          : Local - Enterprise Database for RHEL8/OL8

Repo-revision      : 1717554297

Repo-updated       : Wed 05 Jun 2024 09:24:57 AM +07

Repo-pkgs          : 4,291

Repo-available-pkgs: 3,624

Repo-size          : 13 G

Repo-baseurl       : http://yum-server.taolaoxibup.com/EDB/

Repo-expire        : 172,800 second(s) (last: Wed 05 Jun 2024 10:02:35 AM +07)

Repo-filename      : /etc/yum.repos.d/edb4rhel8.repo

 

Repo-id            : rhel8u10_appstream

Repo-name          : Local - Red Hat Enterprise Linux 8.10 - Appstream

Repo-revision      : 1717553667

Repo-updated       : Wed 05 Jun 2024 09:14:27 AM +07

Repo-pkgs          : 7,117

Repo-available-pkgs: 5,606

Repo-size          : 11 G

Repo-baseurl       : http://yum-server.taolaoxibup.com/AppStream/

Repo-expire        : 172,800 second(s) (last: Wed 05 Jun 2024 10:02:35 AM +07)

Repo-filename      : /etc/yum.repos.d/edb4rhel8.repo

 

Repo-id            : rhel8u10_baseos

Repo-name          : Local - Red Hat Enterprise Linux 8.10 - BaseOS

Repo-revision      : 1717553581

Repo-updated       : Wed 05 Jun 2024 09:13:01 AM +07

Repo-pkgs          : 1,742

Repo-available-pkgs: 1,737

Repo-size          : 1.5 G

Repo-baseurl       : http://yum-server.taolaoxibup.com/BaseOS

Repo-expire        : 172,800 second(s) (last: Wed 05 Jun 2024 10:02:35 AM +07)

Repo-filename      : /etc/yum.repos.d/edb4rhel8.repo

Total packages: 13,150

Ref:

https://www.tecmint.com/create-local-http-yum-dnf-repository-on-rhel-8/

 

Comments

Popular posts from this blog

EDB - Installing EDB Postgres Advanced Server 16

MySQL 8 - Part III: Master - Master Replication with GTID

EDB - Barman - Part I: Installation and Configuration