Create local yum repo

Tony Smith
Tony Smith

There may be occasions where a customer will either run a redHat satellite server or would prefer to build and configure their own. This document will show how to accomplish this using dnf syncrepo

For purposes of this example, we will have the following servers configured :

georgia This the name of the satellite/local yum repository server.

battleship-chains This is the name of the server that will use the local yum repository

RHEL 7 & below

Create the local yum repository

Ensure the packages yum-utils and createrepo are installed using the following command

yum install yum-utils createrepo

Setup the enterprisedb repository on the satellite server as per the standard edb instructions.

Once configured you can check the existence of the repository using yum repolist

The output will be along the lines of ..

yum repolist
Loaded plugins: langpacks, ulninfo
repo id repo name
2ndquadrant-products-bdr_enterprise_3_7-release-pg13/7Server/x86_64 2ndQuadrant packages (PG13) for 7Server - x86_64
2ndquadrant-products-bdr_enterprise_3_7-release-pg13-debug/7Server/x86_64 2ndQuadrant packages (PG13) for 7Server - x86_64 - Debug
!enterprisedb-enterprise/x86_64 enterprisedb-enterprise
!enterprisedb-enterprise-noarch enterprisedb-enterprise-noarch
!enterprisedb-enterprise-source enterprisedb-enterprise-source

With the successful setup of the repository that is to be cloned, we are now in the position to use reposync There are a number of options that can be passed to dnf reposync

--repoid - This is the repo name, from the yum repolist output --arch - You can filter the downloads based on a specified arch --remote_time - This will attempt to maintain the timestamp on the packages --newest-only - Only download the newest versions of the packages in the repository --download-path - This is selfexplanatory explanatory

Below is an example in the use of reposync In this example, we are serving up the repository via a simple apache server so we will use the download path of

/var/www/html/repos/{repoid} Where {repoid} matches the repository name that is being cloned.

Below is an example.

reposync --repoid=enterprisedb-enterprise --download-metadata --arch=x86_64 --newest-only --downloadcomps --download_path=/var/www/html/repos 
(1/978): CGAL-4.7-1.rhel7.1.x86_64.rpm | 254 kB 00:00:01 
(2/978): CGAL-devel-4.7-1.rhel7.1.x86_64.rpm | 4.5 MB 00:00:18 
(3/978): CharLS-1.0-5.el7.x86_64.rpm | 63 kB 00:00:01 
(4/978): SFCGAL-1.3.1-4.rhel7.x86_64.rpm | 15 kB 00:00:00 
(5/978): SFCGAL-devel-1.3.1-4.rhel7.x86_64.rpm | 67 kB 00:00:00 
(6/978): SFCGAL-libs-1.3.1-4.rhel7.x86_64.rpm | 1.7 MB 00:00:03 
(7/978): boost169-atomic-1.69.0-2.el7.x86_64.rpm | 7.5 kB 00:00:00 
(8/978): boost169-chrono-1.69.0-2.el7.x86_64.rpm | 16 kB 00:00:00 
(9/978): boost169-date-time-1.69.0-2.el7.x86_64.rpm | 21 kB 00:00:00 
(10/978): boost169-filesystem-1.69.0-2.el7.x86_64.rpm | 41 kB 00:00:00 
(11/978): boost169-program-options-1.69.0-2.el7.x86_64.rpm | 125 kB 00:00:00 
(12/978): boost169-regex-1.69.0-2.el7.x86_64.rpm | 261 kB 00:00:00 
(13/978): boost169-system-1.69.0-2.el7.x86_64.rpm | 7.2 kB 00:00:00 
(14/978): boost169-thread-1.69.0-2.el7.x86_64.rpm | 44 kB 00:00:00 
(15/978): cfitsio-3.370-10.el7.x86_64.rpm | 528 kB 00:00:01 

Once the repository has been cloned, it needs to be configured as a yum repository, this can be done using createrepo

Change directory to the newly created repository directory, then execute the createrepo command, an example is shown below:

cd /var/www/html/repos/enterprisedb-enterprise
createrepo -v /var/www/html/repos/enterprisedb-enterprise
Spawning worker 0 with 245 pkgs
Spawning worker 1 with 245 pkgs
Spawning worker 2 with 244 pkgs
Spawning worker 3 with 244 pkgs
Worker 0: reading CGAL-4.7-1.rhel7.1.x86_64.rpm
Worker 1: reading CGAL-demos-source-4.7-1.rhel7.1.x86_64.rpm
Worker 2: reading CGAL-devel-4.7-1.rhel7.1.x86_64.rpm
Worker 3: reading CharLS-1.0-5.el7.x86_64.rpm
Worker 0: reading SFCGAL-1.3.1-4.rhel7.x86_64.rpm
Worker 1: reading SFCGAL-devel-1.3.1-4.rhel7.x86_64.rpm
Worker 2: reading SFCGAL-libs-1.3.1-4.rhel7.x86_64.rpm
Worker 3: reading boost169-atomic-1.69.0-2.el7.x86_64.rpm
Worker 0: reading boost169-chrono-1.69.0-2.el7.x86_64.rpm
Worker 1: reading boost169-date-time-1.69.0-2.el7.x86_64.rpm
Worker 2: reading boost169-filesystem-1.69.0-2.el7.x86_64.rpm
Worker 3: reading boost169-program-options-1.69.0-2.el7.x86_64.rpm
Worker 0: reading boost169-regex-1.69.0-2.el7.x86_64.rpm
Worker 1: reading boost169-system-1.69.0-2.el7.x86_64.rpm
Worker 2: reading boost169-thread-1.69.0-2.el7.x86_64.rpm
Worker 3: reading cfitsio-3.370-10.el7.x86_64.rpm
Worker 0: reading edb-as10-edbplus-36.0.2-1.rhel7.x86_64.rpm
Worker 1: reading edb-as10-hdfs_fdw-2.2.0-1.rhel7.x86_64.rpm
Worker 2: reading edb-as10-hdfs_fdw-debuginfo-2.2.0-1.rhel7.x86_64.rpm
Worker 3: reading edb-as10-mongo_fdw-5.4.0-1.rhel7.x86_64.rpm
Worker 0: reading edb-as10-mongo_fdw-debuginfo-5.4.0-1.rhel7.x86_64.rpm
Worker 1: reading edb-as10-mysql5_fdw-2.8.0-1.rhel7.x86_64.rpm
Worker 2: reading edb-as10-mysql5_fdw-debuginfo-2.8.0-1.rhel7.x86_64.rpm
Worker 3: reading edb-as10-mysql8_fdw-2.8.0-1.rhel7.x86_64.rpm
Worker 0: reading edb-as10-mysql8_fdw-debuginfo-2.8.0-1.rhel7.x86_64.rpm
Worker 1: reading edb-as10-pgagent-3.4.1-2.rhel7.x86_64.rpm
Worker 2: reading edb-as10-pgpool36-extensions-3.6.28-1.rhel7.x86_64.rpm
Worker 3: reading edb-as10-pgpool42-extensions-4.2.9-1.rhel7.x86_64.rpm
Worker 0: reading edb-as10-pgpool43-extensions-4.3.2-1.rhel7.x86_64.rpm

As stated, this setup is very simple, with repository served up by apache. To check the packages are available via apache you can use lynx or any other browser of choice.

lynx http://georgia/repos/enterprisedb-enterprise/

Which should produce

Index of /repos/enterprisedb-enterprise (p1 of 18)
Index of /repos/enterprisedb-enterprise

[ICO] Name Last modified Size Description
________________________________________________________________________________________________________________________________________________________________________________________________________________________________

[PARENTDIR] Parent Directory -
[ ] CGAL-4.7-1.rhel7.1.x..> 2022-06-22 05:12 254K
[ ] CGAL-demos-source-4...> 2022-06-22 05:12 12M
[ ] CGAL-devel-4.7-1.rhe..> 2022-06-22 05:12 4.5M
[ ] CharLS-1.0-5.el7.x86..> 2022-06-22 05:12 63K
[ ] SFCGAL-1.3.1-4.rhel7..> 2022-06-22 04:40 15K
[ ] SFCGAL-devel-1.3.1-4..> 2022-06-22 04:40 67K
[ ] SFCGAL-libs-1.3.1-4...> 2022-06-22 04:40 1.7M
[ ] boost169-atomic-1.69..> 2022-06-22 05:16 7.5K
[ ] boost169-chrono-1.69..> 2022-06-22 05:16 16K
[ ] boost169-date-time-1..> 2022-06-22 05:16 21K
[ ] boost169-filesystem-..> 2022-06-22 05:16 41K
[ ] boost169-program-opt..> 2022-06-22 05:16 125K
[ ] boost169-regex-1.69...> 2022-06-22 05:16 261K
[ ] boost169-system-1.69..> 2022-06-22 05:16 7.2K
[ ] boost169-thread-1.69..> 2022-06-22 05:16 44K
[ ] cfitsio-3.370-10.el7..> 2022-06-22 05:16 528K
[ ] edb-as10-edbplus-36...> 2022-06-22 05:12 1.2M
[ ] edb-as10-hdfs_fdw-2...> 2022-06-22 05:12 50K
[ ] edb-as10-hdfs_fdw-de..> 2022-06-29 23:18 158K
[ ] edb-as10-mongo_fdw-5..> 2022-06-22 05:12 66K
[ ] edb-as10-mongo_fdw-d..> 2022-06-29 23:18 260K
[ ] edb-as10-mysql5_fdw-..> 2022-06-22 05:12 40K
[ ] edb-as10-mysql5_fdw-..> 2022-06-29 23:19 171K
[ ] edb-as10-mysql8_fdw-..> 2022-06-22 05:12 40K
[ ] edb-as10-mysql8_fdw-..> 2022-06-29 23:19 172K
[ ] edb-as10-pgagent-3.4..> 2022-06-22 05:12 50K
[ ] edb-as10-pgpool36-ex..> 2022-06-22 05:12 23K
[ ] edb-as10-pgpool42-ex..> 2022-07-05 18:13 25K

Using the locally managed yum repository

On the internal host server that installs from the satellite server, which for this case I've called battleship-chains

You need to create a yum repository file, in /etc/yum.repos.d/edb_local.repo The contents could be as simple as the example shown below:-

[georgia-enterprisedb-enterprise]
name=georgia-enterprisedb-enterprise
baseurl=http://georgia/repos/enterprisedb-enterprise/
repo_gpgcheck=0
enabled=1
gpgcheck=0
sslverify=0
pkg_gpgcheck=0
autorefresh=1
type=rpm-md

Now to test that the packages are indeed available from the satellite server simply use yum list|grep georgia as shown below:

yum list|grep georgia
CGAL.x86_64 4.7-1.rhel7.1 georgia-enterprisedb-enterprise
CGAL-demos-source.x86_64 4.7-1.rhel7.1 georgia-enterprisedb-enterprise
CGAL-devel.x86_64 4.7-1.rhel7.1 georgia-enterprisedb-enterprise
SFCGAL.x86_64 1.3.1-4.rhel7 georgia-enterprisedb-enterprise
SFCGAL-devel.x86_64 1.3.1-4.rhel7 georgia-enterprisedb-enterprise
SFCGAL-libs.x86_64 1.3.1-4.rhel7 georgia-enterprisedb-enterprise
edb-as10-edbplus.x86_64 36.0.2-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-hdfs_fdw.x86_64 2.2.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-hdfs_fdw-debuginfo.x86_64 2.2.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-mongo_fdw.x86_64 5.4.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-mongo_fdw-debuginfo.x86_64 5.4.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-mysql5_fdw.x86_64 2.8.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-mysql5_fdw-debuginfo.x86_64 2.8.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-mysql8_fdw.x86_64 2.8.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-mysql8_fdw-debuginfo.x86_64 2.8.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-pgagent.x86_64 3.4.1-2.rhel7 georgia-enterprisedb-enterprise
edb-as10-pgpool36-extensions.x86_64 3.6.28-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-pgpool42-extensions.x86_64 4.2.9-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-pgpool43-extensions.x86_64 4.3.2-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-pgsnmpd.x86_64 1.0-5.rhel7 georgia-enterprisedb-enterprise
edb-as10-pljava.x86_64 1.5.0-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-postgis.x86_64 3.1.4-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-postgis-core.x86_64 3.1.4-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-postgis-debuginfo.x86_64 3.1.4-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-postgis-docs.x86_64 3.1.4-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-postgis-gui.x86_64 3.1.4-1.rhel7 georgia-enterprisedb-enterprise
edb-as10-postgis-jdbc.x86_64 2.2.1-7 georgia-enterprisedb-enterprise

As can be seen the packages available are the packages available from the locally managed yum repository, and this repository can be used as any other yum repository.

Maintaining the locally managed yum repository

The locally managed yum repository needs relatively light maintenance, however, you should configure some mechanism to keep the locally managed yum repository up to date, easiest option will be to create a cron job that runs the relevant reposync and createrepo commands.

RHEL 8 & above

Create the local yum repository

Ensure the packages yum-utils and createrepo are installed using the following command

dnf install yum-utils createrepo

Setup the enterprisedb repository on the satellite server as per the standard edb instructions.

Once configured you can check the existence of the repository using dnf repolist

The output will be along the lines of ..

[tony@georgia ~]$ dnf repolist
repo id repo name
enterprisedb-enterprise enterprisedb-enterprise
enterprisedb-enterprise-noarch enterprisedb-enterprise-noarch
enterprisedb-enterprise-source enterprisedb-enterprise-source

With the successful setup of the repository that is to be cloned, we are now in the position to use dnf reposync There are a number of options that can be passed to dnf reposync

--repoid - This is self explanatory, and can be gleamed from the dnf repolist output --download-metadata - This will bypass the step of having to run createrepo --arch - You can filter the downloads based on a specified arch --remote-time - This will attempt to maintain the timestamp on the packages --newest-only - Only download the newest versions of the packages in the repository --download-path - This is selfexplanatory explanatory

Below is an example in the use of dnf reposync In this example, we are serving up the repository via a simple apache server so we will use the download path of

/var/www/html/repos/{repoid} Where {repoid} matches the repository id that is being cloned.

dnf reposync --repoid=enterprisedb-enterprise --download-metadata --arch=x86_64 --remote-time --newest-only --download-path=/var/www/html/repos/

A listing of the /var/www/html/repos/{repoid} directory, if successful, should look like ..

ls -l /var/www/html/repos/enterprisedb-enterprise/|more
total 1672312
-rw-r--r--. 1 root root 39136 Jun 22 2022 armadillo-9.700.2-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 198400 Jun 22 2022 arpack-3.7.0-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 12872 Jun 22 2022 boost169-atomic-1.69.0-4.el8.x86_6
4.rpm
-rw-r--r--. 1 root root 26208 Jun 22 2022 boost169-chrono-1.69.0-4.el8.x86_6
4.rpm
-rw-r--r--. 1 root root 30088 Jun 22 2022 boost169-date-time-1.69.0-4.el8.x8
6_64.rpm
-rw-r--r--. 1 root root 52296 Jun 22 2022 boost169-filesystem-1.69.0-4.el8.x
86_64.rpm
-rw-r--r--. 1 root root 155960 Jun 22 2022 boost169-program-options-1.69.0-4.
el8.x86_64.rpm
-rw-r--r--. 1 root root 283876 Jun 22 2022 boost169-regex-1.69.0-4.el8.x86_64
.rpm
-rw-r--r--. 1 root root 12552 Jun 22 2022 boost169-system-1.69.0-4.el8.x86_6
4.rpm
-rw-r--r--. 1 root root 61344 Jun 22 2022 boost169-thread-1.69.0-4.el8.x86_6
4.rpm
-rw-r--r--. 1 root root 590800 Jun 22 2022 cfitsio-3.47-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 531636 Jun 22 2022 CGAL-4.14-1.rhel8.x86_64.rpm
-rw-r--r--. 1 root root 5636712 Jun 22 2022 CGAL-devel-4.14-1.rhel8.x86_64.rpm
-rw-r--r--. 1 root root 83012 Jun 22 2022 clang-13.0.1-1.el8.x86_64.rpm
--More--

As stated, this setup is very simple, with repository served up by apache. To check the packages are available via apache you can use lynx or any other browser of choice.

[tony@georgia ~]$ lynx http://georgia/repos/enterprisedb-enterprise/

Which should give an output similar to

Index of /repos/enterprisedb-enterprise (p1 of 27)
Index of /repos/enterprisedb-enterprise

[ICO] Name Last modified Size Description
______________________________________________________________________________________________________________________________

[PARENTDIR] Parent Directory -
[ ] CGAL-4.14-1.rhel8.x8..> 2022-06-22 05:39 519K
[ ] CGAL-devel-4.14-1.rh..> 2022-06-22 05:39 5.4M
[ ] SFCGAL-1.3.8-1.rhel8..> 2022-06-22 05:16 20K
[ ] SFCGAL-devel-1.3.8-1..> 2022-06-22 05:16 73K
[ ] SFCGAL-libs-1.3.8-1...> 2022-06-22 05:16 1.8M
[ ] SuperLU-5.2.0-7.el8...> 2022-06-22 05:16 191K
[ ] armadillo-9.700.2-1...> 2022-06-22 05:39 38K
[ ] arpack-3.7.0-1.el8.x..> 2022-06-22 05:39 194K
[ ] boost169-atomic-1.69..> 2022-06-22 05:39 13K
[ ] boost169-chrono-1.69..> 2022-06-22 05:39 26K
[ ] boost169-date-time-1..> 2022-06-22 05:39 29K
[ ] boost169-filesystem-..> 2022-06-22 05:39 51K
[ ] boost169-program-opt..> 2022-06-22 05:39 152K
[ ] boost169-regex-1.69...> 2022-06-22 05:39 277K
[ ] boost169-system-1.69..> 2022-06-22 05:39 12K
[ ] boost169-thread-1.69..> 2022-06-22 05:39 60K
[ ] cfitsio-3.47-1.el8.x..> 2022-06-22 05:39 577K
[ ] clang-13.0.1-1.el8.x..> 2022-06-22 05:39 81K
[ ] clang-devel-13.0.1-1..> 2022-06-22 05:39 2.5M
[ ] clang-libs-13.0.1-1...> 2022-06-22 05:38 23M
[ ] clang-resource-files..> 2022-06-22 05:39 14K
[ ] clang-tools-extra-13..> 2022-06-22 05:38 15M
[ ] edb-as11-11.11-1.rhe..> 2022-09-21 02:10 6.4K
[ ] edb-as11-edbplus-37...> 2022-06-22 05:38 1.2M

Using the locally managed yum repository

On the internal host server that installs from the satellite server, which for this case I've called battleship-chains

You need to create a yum repository file, in /etc/yum.repos.d/edb_local.repo The contents could be as simple as the example shown below:-

[georgia-enterprisedb-enterprise]
name=georgia-enterprisedb-enterprise
baseurl=http://georgia/repos/enterprisedb-enterprise/
repo_gpgcheck=0
enabled=1
gpgcheck=0
sslverify=0
pkg_gpgcheck=0
autorefresh=1
type=rpm-md

Now to test that the packages are indeed available from the satellite server simply use dnf repo-pkgs repoid list as shown below:

[root@battleship-chains yum.repos.d]# dnf repo-pkgs georgia-enterprisedb-enterprise list|more
Waiting for process with pid 5675 to finish.
Last metadata expiration check: 0:00:01 ago on Wed 08 Feb 2023 06:08:00 EST.
Available Packages
CGAL.x86_64 4.14-1.rhel8 georgia-enterprisedb-enterprise
CGAL-devel.x86_64 4.14-1.rhel8 georgia-enterprisedb-enterprise
SFCGAL.x86_64 1.3.8-1.rhel8 georgia-enterprisedb-enterprise
SFCGAL-devel.x86_64 1.3.8-1.rhel8 georgia-enterprisedb-enterprise
SFCGAL-libs.x86_64 1.3.8-1.rhel8 georgia-enterprisedb-enterprise
SuperLU.x86_64 5.2.0-7.el8 georgia-enterprisedb-enterprise
armadillo.x86_64 9.700.2-1.el8 georgia-enterprisedb-enterprise
arpack.x86_64 3.7.0-1.el8 georgia-enterprisedb-enterprise
boost169-atomic.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-chrono.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-date-time.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-filesystem.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-program-options.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-regex.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-system.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
boost169-thread.x86_64 1.69.0-4.el8 georgia-enterprisedb-enterprise
cfitsio.x86_64 3.47-1.el8 georgia-enterprisedb-enterprise
edb-as11.x86_64 11.11-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-edbplus.x86_64 37.0.2-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-hdfs_fdw.x86_64 2.3.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-hdfs_fdw-debuginfo.x86_64 2.3.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-hdfs_fdw-debugsource.x86_64 2.3.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-mongo_fdw.x86_64 5.5.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-mongo_fdw-debuginfo.x86_64 5.5.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-mongo_fdw-debugsource.x86_64 5.5.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-mysql8_fdw.x86_64 2.9.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-mysql8_fdw-debuginfo.x86_64 2.9.0-1.rhel8 georgia-enterprisedb-enterprise
edb-as11-mysql8_fdw-debugsource.x86_64 2.9.0-1.rhel8 georgia-enterprisedb-enterprise
--More--

As can be seen the packages available are the packages available from the locally managed yum repository, and this repository can be used as any other yum repository.

Maintaining the locally managed yum repository

The locally managed yum repository needs relatively light maintenance, however, you should configure some mechanism to keep the locally managed yum repository up to date, easiest option will be to create a cron job that runs the relevant dnf reposync command.

Was this article helpful?

0 out of 0 found this helpful