Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

How to add Nginx repo to my local yum repository

GadoDec 26 2023 — edited Dec 27 2023

I am using Oracle Linux 8.

I recently created a local yum repo following this link. And I connected all other servers to it and all is working fine. Except for Nginx. This is because to install Nginx I had to add a separate yum config file “nginx.repo”:

[nginx]
name=nginx repo
baseurl=https://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=0

But now I don't want to use internet on this machine again especially after creating the local repo. So I moved this repo config file to the local yum repo and then run this:

# reposync --newest-only --download-metadata --repoid=nginx -p /u01/repo/OracleLinux

The sync was successful. Then I went to the Nginx server and updated the local yum config file “local-ol8.repo”:

[local_ol8_baseos_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://ol8-yum.<domain>/repo/OracleLinux/ol8_baseos_latest/$basearch/
gpgkey=http://ol8-yum.<domain>/RPM-GPG-KEY-oracle-ol8
gpgcheck=1
enabled=1

[local_ol8_appstream]
name=Oracle Linux AppStream $releasever Latest ($basearch)
baseurl=http://ol8-yum.<domain>/repo/OracleLinux/ol8_appstream/$basearch/
gpgkey=http://ol8-yum.<domain>/RPM-GPG-KEY-oracle-ol8
gpgcheck=1
enabled=1

[local_ol8_UEKR6]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://ol8-yum.<domain>/repo/OracleLinux/ol8_UEKR6/$basearch/
gpgkey=http://ol8-yum.<domain>/RPM-GPG-KEY-oracle-ol8
gpgcheck=1
enabled=1

[local_ol8_UEKR6]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://ol8-yum.<domain>/repo/OracleLinux/ol8_UEKR6/$basearch/
gpgkey=http://ol8-yum.<domain>/RPM-GPG-KEY-oracle-ol8
gpgcheck=1
enabled=1

[nginx]
name=nginx repo
baseurl=http://ol8-yum.<domain>/repo/OracleLinux/nginx/$releasever/$basearch/
gpgcheck=0
enabled=1

But when I run any yum update command on the Nginx server I get this error:

Repository nginx is listed more than once in the configuration
Oracle Linux 8 Latest (x86_64)                   1.6 MB/s | 3.6 kB     00:00
Oracle Linux AppStream 8 Latest (x86_64)         2.6 MB/s | 3.9 kB     00:00
Latest Unbreakable Enterprise Kernel for Oracle  2.0 MB/s | 3.0 kB     00:00
nginx repo                                        56 kB/s | 196  B     00:00
Errors during downloading metadata for repository 'nginx':
  - Status code: 404 for http://ol8-yum.<domain>/repo/OracleLinux/nginx/8/x86_64/repodata/repomd.xml (IP: 192.168...)
Error: Failed to download metadata for repo 'nginx': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

So how can I fix this?

Thanks

Gado

This post has been answered by Gado on Dec 27 2023
Jump to Answer
Comments
Post Details
Added on Dec 26 2023
1 comment
75 views