How to create Linux Local Repository using ISO Image

Create a local repository using iso image to installation Oracle RPM.

Local Repository

This blog will cover the local repository creation using iso image. Most environment customers are not exposing their servers to the internet due to many security reasons. So we need to find a way to installed the required RPM using yum. This is article is all about addressing this rpm installation from the yum repository. The default yum repository is working with the internet. But we can create a local repository to run yum commands without using the internet.

In this scenario, we are using cd rom to mount the iso image and create a local repository using the iso image.

For this testing, we are using the Virtual Box to mount the iso image.

First, change the boot priority and mount the image to virtual cd rom.

Change the boot priority as mentioned below.

RL7 19c Settings

Browse the RL7 image.

RL7 19c Settings

First, we need to mount the iso image to Linux VM Box.

After mounting this to the Virtual Machine. run df -h to verify that cd rom is mounted to Linux Machine.

[root@crs01 ~]# df -h
Filesystem                       Size  Used Avail Use% Mounted on
devtmpfs                         1.8G     0  1.8G   0% /dev
tmpfs                            1.8G  4.0K  1.8G   1% /dev/shm
tmpfs                            1.8G  9.5M  1.8G   1% /run
tmpfs                            1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/mapper/ol-root               38G  5.4G   32G  15% /
/dev/mapper/oradatavg-oradatalv   19G   45M   18G   1% /oradata
/dev/mapper/orabinvg-orabinlv     29G   45M   27G   1% /u01
/dev/mapper/ol-home               19G   33M   19G   1% /home
/dev/sda1                       1014M  235M  780M  24% /boot
tmpfs                            365M   28K  365M   1% /run/user/0
/dev/sr0                         4.5G  4.5G     0 100% /run/media/root/OL-7.9 Server.x86_64
[root@crs01 ~]#

 

1. Create a soft link to cd rom 

 We need to set up this in the local mount point because cdr om is the read-only mode. Now we need to create a soft link to the local directory using the mounted cdr om iso image.

[root@crs01 cdrom]# mkdir /cdrom
[root@crs01 cdrom]# ln -s '/run/media/root/OL-7.9 Server.x86_64' /cdrom/  -- As this has space we have to use quotations
[root@crs01 cdrom]# cd /cdrom/
[root@crs01 cdrom]# ls -lrth
total 0
lrwxrwxrwx. 1 root root 36 Sep 22 14:51 OL-7.9 Server.x86_64 -> /run/media/root/OL-7.9 Server.x86_64

 

1.1 Install create repo package 

 We need createrepo-* rpm to create the repository. Install this rpm as an initial step.

[root@crs01 OL-7.9 Server.x86_64]# cd Packages/
[root@crs01 Packages]# ls -l createrepo*
-rw-rw-r--. 1 root root 95344 May 27  2017 createrepo-0.9.9-28.el7.noarch.rpm
[root@crs01 Packages]# rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm
warning: createrepo-0.9.9-28.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                          ################################# [100%]
        package createrepo-0.9.9-28.el7.noarch is already installed
[root@crs01 Packages]#

 

1.2 Create Repo

 createrepo -v /cdrom 

 

1.3 Add an entry to yum.repos.d

Create a new file and add below mention entries to specifying the local mount point path, In this case, it’s /cd rom. There will be more repo entries that use the internet to download rpm files. so you can move these files to get clean output for yum repolist output.

######## create yum reportformat
[root@crs01 Packages]# cat /etc/yum.repos.d/cdrom.repo
[cdrom]
name=OL7.9
baseurl=file:///cdrom
gpgcheck=0
enable=0
[root@crs01 Packages]#

-- move yum entries as mention below.

root@crs01 Packages]# cd /etc/yum.repos.d/
[root@crs01 yum.repos.d]# ls -lrth
total 20K
-rw-r--r--. 1 root root  226 Jul  1  2020 virt-ol7.repo
-rw-r--r--. 1 root root 2.6K Jul  1  2020 uek-ol7.repo
-rw-r--r--. 1 root root 4.2K Jul  1  2020 oracle-linux-ol7.repo
-rw-r--r--. 1 root root   61 Sep 22 14:56 cdrom.repo
[root@crs01 yum.repos.d]# mv virt-ol7.repo virt-ol7.repo.ori
[root@crs01 yum.repos.d]# mv uek-ol7.repo uek-ol7.repo.ori
[root@crs01 yum.repos.d]# mv oracle-linux-ol7.repo oracle-linux-ol7.repo.ori

 

1.4 Verification

Now run the yum repolist command to get clean repolist output.

[root@crs01 yum.repos.d]# yum repolist
Loaded plugins: langpacks, ulninfo
repo id                                                                                                             repo name                                                                                                          status
cdrom                                                                                                               OL7.9                                                                                                              5,320
repolist: 5,320

 

2. Install Oracle prerequisite packages to 19c

Use yum install -y oracle-database-preinstall-19c command to install 19c prerequisites rpm.

[root@crs01 yum.repos.d]# yum install -y oracle-database-preinstall-19c
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-2.el7 will be installed
--> Processing Dependency: libaio-devel for package: oracle-database-preinstall-19c-1.0-2.el7.x86_64
--> Processing Dependency: ksh for package: oracle-database-preinstall-19c-1.0-2.el7.x86_64
--> Running transaction check
---> Package ksh.x86_64 0:20120801-142.0.1.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================
 Package                                                                 Arch                                            Version                                                        Repository                                      Size
=============================================================================================================================================================================================================================================
Installing:
 oracle-database-preinstall-19c                                          x86_64                                          1.0-2.el7                                                      cdrom                                           19 k
Installing for dependencies:
 ksh                                                                     x86_64                                          20120801-142.0.1.el7                                           cdrom                                          882 k
 libaio-devel                                                            x86_64                                          0.3.109-13.el7                                                 cdrom                                           12 k
Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)
Total download size: 914 k
Installed size: 3.2 M
Downloading packages:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        105 MB/s | 914 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ksh-20120801-142.0.1.el7.x86_64                                                                                                                                                                                           1/3
  Installing : libaio-devel-0.3.109-13.el7.x86_64                                                                                                                                                                                        2/3
  Installing : oracle-database-preinstall-19c-1.0-2.el7.x86_64                                                                                                                                                                           3/3
  Verifying  : oracle-database-preinstall-19c-1.0-2.el7.x86_64                                                                                                                                                                           1/3
  Verifying  : libaio-devel-0.3.109-13.el7.x86_64                                                                                                                                                                                        2/3
  Verifying  : ksh-20120801-142.0.1.el7.x86_64                                                                                                                                                                                           3/3
Installed:
  oracle-database-preinstall-19c.x86_64 0:1.0-2.el7
Dependency Installed:
  ksh.x86_64 0:20120801-142.0.1.el7                                                                                   libaio-devel.x86_64 0:0.3.109-13.el7
Complete!
Share on:
Come work with the Best