public-yum-ol7.repo
Here are steps to install Oracle Linux 7 yum repository to one of RHEL derivatives, CentOS 7.
For RHEL 8 and its derivatives, you may refer to the post: How to Setup Oracle Linux 8 Yum Repository.
Download Oracle Linux 7 Public Yum Repository
First of all, you should make sure you have wget to download the file.
[root@primary01 ~]# which wget
/usr/bin/wget
If there's none, please install it.
[root@primary01 ~]# yum -y install wget
...
Then we download the repository from Oracle public yum server.
[root@primary01 ~]# cd /etc/yum.repos.d/
[root@primary01 yum.repos.d]# wget http://yum.oracle.com/public-yum-ol7.repo
[root@primary01 yum.repos.d]# ll public-yum-ol7.repo
-rw-r--r--. 1 root root 16402 Aug 26 2019 public-yum-ol7.repo
Download Oracle Linux 7 GPG Key
To prevent GPG key retrieval failed, we need to download the right GPG key for Oracle yum repository.
[root@primary01 yum.repos.d]# wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
[root@primary01 yum.repos.d]# ll /etc/pki/rpm-gpg/
total 16
-rw-r--r--. 1 root root 1690 Oct 23 2020 RPM-GPG-KEY-CentOS-7
-rw-r--r--. 1 root root 1004 Oct 23 2020 RPM-GPG-KEY-CentOS-Debug-7
-rw-r--r--. 1 root root 1690 Oct 23 2020 RPM-GPG-KEY-CentOS-Testing-7
-rw-r--r--. 1 root root 1011 Jul 23 2014 RPM-GPG-KEY-oracle
Please note that, the target filename has been changed and different from the source.
Here we leave an informative release version for this OS.
[root@primary01 ~]# echo "Oracle Linux Server release 7.9" > /etc/oracle-release
Install Newest Oracle Linux 7 Public Yum Repository
To install the newest Oracle Software yum repository configuration that can manage packages more granularly from Oracle.
[root@primary01 yum.repos.d]# yum -y install oracle-software-release-el7
...
Enable Newest Oracle Yum Repository Configuration
We need to execute the following command to enable them.
[root@primary01 yum.repos.d]# /usr/bin/ol_yum_configure.sh
Repository ol7_UEKR5 already enabled
Repository ol7_latest already enabled
Let's see what we have now.
[root@primary01 yum.repos.d]# ll
total 80
-rw-r--r--. 1 root root 1664 Oct 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Oct 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Oct 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Oct 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Oct 23 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Oct 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 Oct 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 Oct 23 2020 CentOS-x86_64-kernel.repo
-rw-r--r--. 1 root root 4586 Mar 8 13:59 oracle-linux-ol7.repo
-rw-r--r--. 1 root root 251 Sep 28 02:52 oracle-software-ol7.repo
-rw-r--r--. 1 root root 16402 Aug 26 2019 public-yum-ol7.repo.sav
-rw-r--r--. 1 root root 2587 Mar 8 13:59 uek-ol7.repo
-rw-r--r--. 1 root root 226 Jun 9 2021 virt-ol7.repo
Optionally, you can remove or keep CentOS repositories.
[root@primary01 yum.repos.d]# rm -f ./CentOS-*
Let's check some Oracle dedicated package. For example,
[root@primary01 ~]# yum info oracle-rdbms-server-12cR1-preinstall
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name : oracle-rdbms-server-12cR1-preinstall
Arch : x86_64
Version : 1.0
Release : 7.el7
Size : 21 k
Repo : ol7_latest/x86_64
Summary : Sets the system for Oracle Database single instance and Real
: Application Cluster install for Oracle Linux 7
License : GPLv2
Description : The Oracle Preinstallation RPM package installs software packages
: and sets system parameters required for Oracle Database single
: instance and Oracle Real Application Clusters installations for
: Oracle Linux Release 7 Files affected: /etc/sysctl.conf,
: /boot/grub/menu.lst OR /boot/grub2/grub.cfg Files added:
: /etc/security/limits.d/oracle-rdbms-server-12cR1-preinstall.conf
Done!